Hot Potato Elimination
People stand in a circle in the given order. Counting starts at the first person as 1; the k-th person counted is eliminated and counting resumes from the next person. Print the name of the last remaining person.
Constraints
1 <= n <= 1000
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.