Solve Josephus Problem