Interview Questions

Solving puzzle with programming

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.

Most interesting Questions asked in an interview

Most interesting Questions asked in an interview

1. A murderer is condemned to death. He has to choose between three rooms.
The first is full of raging fires, the second is full of assassins with loaded guns, and the third is full of lions that haven't eaten in 3 years. Which room is safest for him?

2. A woman shoots her husband. Then she holds him under water for over 5 minutes. Finally, she hangs him. But 5 minutes later they both go out together and enjoy a wonderful dinner together. How can this be?