Last Friend Standing
CodeChefOpen on judge ↗
Problem Statement Mark and his classmates were playing a game called “last man standing”. The last person left would have to be treated by the rest. The game went like this. From among n of his classmates, numbered 1, 2,...,n, standing in a circle every mth person is going to be disqualified. Mark is smart enough to choose the position of the last remaining person, thus always getting a treat. No
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.
Sign in to chat with the tutor and save your progress.
Sign in to start