Who’s the survivor?
100 people standing in a circle in an order of 1 to 100.
The first person has a sword. He kills the next person and gives the sword to the next (i.e no.3).
All person does the same until only one survives.
Which number survives at the last?
The explanation can be possible by taking the number of persons in an array from 1 to 100 which is explained on the image beside.
To avoid this, we also have a short trick for this problem.
This is the famous Josephus Problem.
The solution requires getting the nearest smaller number that is the power of 2, in this case, 2^6=64, and subtract it from 100. Thus 100-64=36.
Now we apply the formula,
2n+1 = 2*36+1 = 72+1 = 73.