1535. Find the Winner of an Array Game
Содержание
class Solution:
def getWinner(self, arr: List[int], k: int) -> int:
mx = arr[0]
cnt = 0
for x in arr[1:]:
if mx < x:
mx = x
cnt = 1
else:
cnt += 1
if cnt == k:
break
return mx