SIMPLE - JavaScript - O(N) Solution
\nvar getWinner = function(arr, k) {\n        if (k >= arr.length) {\n        return Math.max(...arr);\n    }\n    let winMap = {};\n    let n1 = arr[0];\n    l
```\nvar getWinner = function(arr, k) {\n        if (k >= arr.length) {\n        return Math.max(...arr);\n    }\n    let winMap = {};\n    let n1 = arr[0];\n    let n2 = undefined;\n    for (let i = 1; i < arr.length; i++) {\n        n2 = arr[i];\n        if (n1 > n2) {\n            winMap[n1] = (winMap[n1] || 0) + 1;\n            if (winMap[n1] >= k) {\n                return n1;\n            }\n        }\n        else if (n1 < n2) {\n            winMap[n2] = (winMap[n2] || 0) + 1;\n            if (winMap[n2] >= k) {\n                return n2;\n            }\n\n            n1 = n2;\n        }\n    }\n    return Math.max(...arr);\n};\n```
['JavaScript']