diff --git a/medium/find_the_winner_of_the_circular_game.py b/medium/find_the_winner_of_the_circular_game.py new file mode 100644 index 0000000..7850569 --- /dev/null +++ b/medium/find_the_winner_of_the_circular_game.py @@ -0,0 +1,8 @@ +# https://leetcode.com/problems/find-the-winner-of-the-circular-game + +class Solution: + def findTheWinner(self, n: int, k: int) -> int: + result = 1 + for i in range(2, n + 1): + result = (result + k - 1) % i + 1 + return result