← All problemsSign in

Count the Steps

In a library, there are n racks. Each rack contains k books. The books are numbered from 0 to (n*k)-1. There is a ladder to reach all the racks except the bottom-most rack. You need to find out the number of steps the chef needs to climb in the ladder to get all the books, where one step is when the chef reaches from one rack to the next higher rack or the next lower rack. The chef must be in the

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start