NVIDIA interview question

How would you solve the Josephus problem.