100 People in a Circle

100 people standing in a circle in an order 1 to 100.

No.1 has a sword.
He kills next person (i.e. no. 2) and gives sword to next to next (i.e no.3).
All person does the same until only 1 survives.

Which number survives at the last?

Answer is a integer. Just put the number without any decimal places if its an integer. If the answer is Infinity, output Infinity.

Feel free to get in touch with us if you have any questions

Sign Up
to access hints and editorial solutions for 100 People in a Circle
2962 successful submissions.
Click here to start solving coding interview questions