The Josephus Problem
Medium
There are n people standing in a circle, numbered from 0 to n - 1. Starting from person 0, count k people clockwise and remove the kth person. After the removal, begin counting again from the next person still in the circle. Repeat this process until only one person remains, and return that person's position.
Example:
Input: n = 5, k = 2
Output: 2
Constraints:
- There will be at least one person in the circle
kwill at least be equal to 1.