Given N number of people, each marked as a number starting from $1$ through N, standing in a straight line where you remove folks alternatively from a line.
For example in iteration 1: You would remove $1,3,5...$
Iteration $2 : 2,6,10...$
etc. until there is one person standing.
Find the index of the last person standing for a given value of N.
We can look at the process like this:
Therefore, the last number standing is the highest power of $2$ less than or equal to $N$.