🔥O(n) || C++ || Only 1 for loop || ✅ Without any Data Structure ✅ || 0(1) space🔥
\n# Complexity\n- Time complexity: O(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 g
\n# Complexity\n- Time complexity: O(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>& a, int k) {\n        int maxi=a[0],c=0;\n        for(int i=1;i<a.size();i++){\n            if(c==k) return maxi;\n            if(maxi>a[i]) c++;\n            else c=1,maxi=a[i];\n        }\n        return maxi;\n    }\n};\n```
['C++']