Java | Easy one | One pass |  With clear explanation
\nExplanation:-\n    The idea is how many rounds the current winner can win before the new winner comes.\n    If the current winner wins k round, then return th
```\nExplanation:-\n    The idea is how many rounds the current winner can win before the new winner comes.\n    If the current winner wins k round, then return that winner\n\t\n\tI have seen many people having a problem when k > n\n\tSo, if k > n, then there is no element that can win k consecutive rounds except the maximum number.\n\t\n\tEx:- \n\tSuppose we have A = [1, 2, 3] and k = 5\n\tRound 1 : A = [2, 3, 1] and wins = 1 (2 won)\n\tR2 : A = [3, 1, 2] and wins = 1 (3 won)\n\tR3 : A = [3, 2, 1] and wins = 2 (3 won)\n\tR4 : A = [3, 1, 2] and wins = 3 (3 won)\n\tR5 : A = [3, 2, 1] and wins = 4 (3 won)\n\tR6 : A = [3, 1, 2] and wins = 5 (3 won)\n\t\n\tNow, 3 won 5 consecutive rounds. So, 3 is the winner.\n\t\n\tFrom above example, we can understand that\n\tif k > n, maximum number in the array will be moved to 0th position, \n\tno matter how much bigger your k is, the maximum number is always winner.\n\t\n\tThat\'s why we are not checking the case k > n.\n\tHere, what we are cheking is an element that can win k consecutive rounds, \n\tif we found, then we are coming out of the loop and returning the winner.\n\t\n\tIF YOU HAVE ANY DOUBTS, FEEL FREE TO ASK\n```\n```\nclass Solution {\n    public int getWinner(int[] arr, int k) {\n        int winner = arr[0];\n        int wins = 0;\n        for(int i = 1; i < arr.length; i++){\n            if(winner > arr[i])\n\t\t\t    // increment wins count\n                wins++;\n            else{\n                wins = 1;\n\t\t\t\t// new winner\n                winner = arr[i];\n            }\n            if(wins == k)\n\t\t\t    // if wins count is k, then return winner \n                break;\n        }\n        return winner;\n    }\n}\n```\n\nI have started a series on solid principles and design patterns. If anyone is interested, please check [it](https://medium.com/@bhanu150138/mastering-solid-principles-and-design-patterns-a-blog-series-for-writing-clean-scalable-code-aae3809310db) out.
['Array', 'Simulation']