Today, I stumbled upon an interesting puzzle in whatsapp group. The puzzle goes as below:
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?
Someone had already given answer but I thought to confirm it with programming as it could be a nice example of solving puzzle with programming. Before starting to code one must create logic/flow for it. This is how I broke down the puzzle.