EASY C++ ||  JAVA solution || just compare
IDEAS-\n The idea is how many rounds the current winner can win before the new winner comes.\n and return the element if no of wins is equla to k.\n \n   C++\n\
IDEAS-\n The idea is how many rounds the current winner can win before the new winner comes.\n and return the element if no of wins is equla to k.\n \n   C++\n```\nclass Solution {\npublic:\n    int getWinner(vector<int>& arr, int k) {\n        \n     auto i1 = std::max_element(arr.begin(), arr.end());     //finding maximum element in vector\n        int maxi=max(arr[0],arr[1]);\n        \n         if(k==1)\n           return maxi;\n        \n        if(arr.size()<=k)   // if vector size greater than k return max element\n          return *i1;\n        \n     \n        for(int i=2; i<arr.size(); i++)\n        {\n             if(arr[i]>maxi)\n            {\n                maxi=arr[i];\n                cnt=0;\n            }\n            cnt++;\n          if(cnt==k || arr[i]==*i1)\n                return maxi;\n        }\n\t\treturn maxi;\n    }\n};\n```\n\nJAVA\n```\nlass Solution {\n    public int getWinner(int[] arr, int k) {\n        \n         int il=0;     //finding maximum element in vector\n        \n        for(int i=0; i<arr.length; i++)\n        {\n            il=Math.max(il,arr[i]);\n        }\n        int maxi=Math.max(arr[0],arr[1]);\n        \n         if(k==1)\n           return maxi;\n        \n        int cnt=1;\n        \n        if(arr.length<=k)   // if vector size greater than k return max element\n          return il;\n        \n     \n        for(int i=2; i<arr.length; i++)\n        {\n             if(arr[i]>maxi)\n            {\n                maxi=arr[i];\n                cnt=0;\n            }\n            cnt++;\n          if(cnt==k || arr[i]==il)\n                return maxi;\n        }\n\t\treturn maxi;\n    }\n}\n```\nUpvote if u like the idea
['C', 'C++', 'Java']