← All problemsSign in

Magical Stick

Ted has a magical stick. He can put life in that stick and makes it move wherever he wants. His friend Barney gave him a box which has some paths. The inside structure of the box is like a ladder having N horizontal pipes, numbered 1 to N from bottom to top. It also has 2 Vertical pipes, one on the left and other on the right. Barney placed K crabs at distinct locations inside the pipes of the lad

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