Most Easiest Code using simple if-else|| C++
Intuition\nTake a queue and continuosly push the smaller element among the arr[0] and arr[1] and increment the count .\nIf(count==k)\n    return curr greater el
# Intuition\nTake a queue and continuosly push the smaller element among the arr[0] and arr[1] and increment the count .\nIf(count==k)\n    return curr greater element\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int getWinner(vector<int>& arr, int k) {\n        int curr=arr[0];\n        int count=0;\n\n        int maxElement=*max_element(arr.begin(),arr.end());\n        queue<int>q;\n        for(int i=1;i<arr.size();i++){\n            q.push(arr[i]);\n        }\n\n        while(!q.empty()){\n            int opponent=q.front();\n            q.pop();\n\n            if(curr>opponent){\n                count++;\n                q.push(opponent);\n            }\n            else{\n                curr=opponent;\n                count=1;\n                q.push(curr);\n            }\n\n            if(curr==maxElement)\n                return curr;\n            \n            else if(count==k)\n                return curr;\n\n        }\n        return -1;\n    }\n};\n```
['C++']