This is a verified interview question from Arm. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Circular Elimination Game - ARM Online Assessment DTU" covers key patterns like Arrays.
"There are `n` players sitting in a circle. The game starts from player `i`, and a value `k` is given. In each round, players are counted in the circular manner, and the player at position `i + k` is eliminated. After eliminating a player, the counting continues from the next remaining player. This process continues until the required number of rounds is completed. Your task is to determine **how many players are eliminated after `k` rounds**. ### Input * The first line contains an integer `n` — the number of players. * The second line contains two integers `i` and `k`: * `i` — the starting player. * `k` — the number of rounds. ### Output Print the **number of players eliminated after `k` rounds**. ### Constraints ```text 1 ≤ n ≤ 10^9 1 ≤ i ≤ n 1 ≤ k ≤ n ``` ### Example ```text Input: 10 2 3 Output: 3 ``` ### Explanation There are `10` players arranged in a circle. The game starts from player `2`. In every round, counting continues circularly and the player at the required `i + k` position is eliminated. After `3` rounds, `3` players have been eliminated."
Join thousands of developers practicing for Arm.