Best and easy Approach O(n)  || Beats 100% 🔥🔥
Intuition\nfirst thought came in my mind was that simply use arrayList and perform the operation as per the question says (putting the loser element at the last
# Intuition\nfirst thought came in my mind was that simply use arrayList and perform the operation as per the question says (putting the loser element at the last),\nbut it time limit exceeds if k> 10^6\nSo, by carefull observation we can iterate through the array and update the maxElement(winner) and its winning streak by 1 \nIf the winning streak reaches k , then return maxElement \n\n# Approach\nInitialize \'maxE\' with the first element of \'arr\' and \'cL\' (consecutive losses) to 0.\n\nIterate through \'arr\' from the second element onward.\n\nIf \'maxE\' is greater than the current element, increment \'cL.\' If \'cL\' reaches \'k,\' return \'maxE\' as the winner.\n\nIf the current element is greater than \'maxE,\' reset \'cL\' to 1 and update \'maxE\' to the current element. If \'cL\' reaches \'k,\' return \'maxE\' as the winner.\n\nAfter the loop, return \'maxE\' as the winner.\n\n# Complexity\n- Time complexity:\n$$O(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int getWinner(int[] arr, int k) {\n      int maxE=arr[0];\n      int n=arr.length;\n      \n        int cL=0;\n      for(int i=1;i<n;i++){\n         if(maxE>arr[i]){\n             cL++;\n             if(cL==k) return maxE;\n         }\n          else{\n              cL=1;\n              maxE=arr[i];\n              if(cL==k) return maxE;\n          }\n      }\n        return maxE;\n    }\n}\n```
['Java']