Python short and clean. Functional programming.
Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\nwhere,\nn is length of arr.\n\n# Code\npython\nclass Solution:\n    def getWinner(self, arr: 
# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\nwhere,\n`n is length of arr`.\n\n# Code\n```python\nclass Solution:\n    def getWinner(self, arr: list[int], k: int) -> int:\n        maxes = islice(accumulate(arr, max), 1, None)\n        winners = (x for x, g in groupby(maxes) if sum(1 for _ in g) >= k)\n        return next(winners, max(arr))\n\n\n```
['Array', 'Simulation', 'Python', 'Python3']