Simple Solution ✅ using Two 2️⃣ Pointer Approach with Explanation 🔥🔥
Approach\n Describe your approach to solving the problem. \n\n- i, j se compare krlenge, and replace accordingly\n- cnt, will track the winner \n- if, cnt==k th
# Approach\n<!-- Describe your approach to solving the problem. -->\n\n- i, j se compare krlenge, and replace accordingly\n- cnt, will track the winner \n- if, cnt==k then arr[i] will be the winner\n- if loop exits and then return the maxElement of the array\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int getWinner(vector<int>& arr, int k) {\n        int n = arr.size();\n        int i=0, j=1, cnt=0;\n\n        while(i<n && j<n){\n            if(arr[i]>arr[j]){\n                j++;cnt++;\n            }else{\n                i=j;\n                j++; cnt=1;\n            }\n\n            if(cnt==k) return arr[i];\n        }\n\n        int maxi = *max_element(arr.begin(),arr.end());\n        return maxi;\n    }\n};\n\n\n```
['Two Pointers', 'C++']