Very simple c++ solution
\nclass Solution {\npublic:\n    int getWinner(vector<int>& arr, int k) {\n        int n = arr.size();\n        unordered_map<int, int> cnt;\n        if(k >= n)
```\nclass Solution {\npublic:\n    int getWinner(vector<int>& arr, int k) {\n        int n = arr.size();\n        unordered_map<int, int> cnt;\n        if(k >= n)\n            return *max_element(arr.begin(), arr.end());\n        int p1 = 0, p2 = 1;\n        while(p1 < n and p2 < n)\n        {\n            if(arr[p1] > arr[p2])\n            {\n                p2++;\n                cnt[arr[p1]]++;\n                if(cnt[arr[p1]] == k)\n                    return arr[p1];\n            }\n            else if(arr[p1] < arr[p2])\n            {\n                cnt[arr[p2]]++;\n                if(cnt[arr[p2]] == k)\n                    return arr[p2];\n                p1 = p2;\n                p2++;\n            }\n        }\n        return *max_element(arr.begin(), arr.end());\n        \n    }\n};\n```
[]