A program to find the solution of an interesting puzzle ...
In this puzzle, we have N number of people standing in a circle. They are numbered (1 - N). Initially, the first person carries a sword. The 'sword carrier' kills the next person, then passes it to the next person standing. This continues until only 1 person is still alive.
Who is the last person standing?
Compile the Puzzle.java file to get a Puzzle.class file :
javac Puzzle.java
(the .class file is available in the repository) ... and run it as follows :
java Puzzle [number of people - 100 by default] [number of people to be left alive - 1 by default]