← All problemsSign in

Ant man and the handshake cabin

###Question: Our little ant-man is now currently in the quantum realm. He is waiting for a portal to open so that he can escape from the quantum realm. In our real world, there are $n$ persons numbered from *1 to n* in a special cabin. The uniqueness of the cabin is that when two persons shake hands, a portal will open on the hand of a person in the cabin just before it ( not necessarily those w

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