DDSA
Advertisement

1823. Find the Winner of the Circular Game

1823.cs
C#
public class Solution
{
    public int FindTheWinner(int n, int k)
    {
        int ans = 0;
        for (int i = 2; i <= n; i++)
            ans = (ans + k) % i;

        return ans + 1;
    }
}
Advertisement
Was this solution helpful?