Simple simulation-Java code-one pass
\nclass Solution {\n    public int getWinner(int[] arr, int k) {\n        int n=arr.length;\n        int cnt=0,w,i;\n        for(w=0,i=1 ;i<n ;){ //w points to 
```\nclass Solution {\n    public int getWinner(int[] arr, int k) {\n        int n=arr.length;\n        int cnt=0,w,i;\n        for(w=0,i=1 ;i<n ;){ //w points to arr[0] and i to arr[1]\n            if(arr[w]>arr[i]){\n                cnt++;i++;\n            }\n            else{\n                cnt=1;\n                w=i; i=w+1;// new arr[0] and arr[1] \n            }\n            if(cnt==k)return arr[w]; \n        }\n        return arr[w];//if k is large w points to the max element of the array\n    }\n}\n```
['Java']