8 lines
259 B
Python
8 lines
259 B
Python
# 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
|