89. Josephus Circle Survivor
MediumQueues
People numbered 1 to n stand in a circle. Starting from person 1, count k people clockwise (including the starting person); the k-th person leaves the circle. Counting resumes from the next person. Return the number of the last person remaining.
Example 1
Input: n = 5, k = 2 Output: 3 Explanation: People leave in the order 2, 4, 1, 5.
Constraints
1 ≤ n ≤ 5001 ≤ k ≤ 500