Josephus Problem (Circular List)
Medium
Linked List (Advanced)
n people stand in a circle numbered 1..n. Starting at person 1, every k-th person is eliminated until one remains. Print the survivor's number.
Constraints
1 <= n <= 10^5 1 <= k <= 10^5
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.