1823. Find the Winner of the Circular Game

Photo by Artem Kniaz on Unsplash

1823. Find the Winner of the Circular Game

class Solution:
    def findTheWinner(self, n: int, k: int) -> int:
        circle = [_ for _ in range(1, n + 1)]
        k -= 1
        position = 0 # At start

        while len(circle) > 1:
            position += k
            position = position % len(circle)
            circle.pop(position)

        return circle[0]