← All problemsSign in

Last One Standing

Once upon a time, there was a circle of N persons. The people stood in a clockwise direction, and there was an integer K. The king of the land ordered that starting from the first position, every Kth person clockwise from the current position would be killed. After killing a person, the current position would be shifted to the position of (K+1)th alive person, and the same step would be repeated u

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