C++ O(N) time complexity O(1) memory with explanation
The basic idea is to iterate through the array from left to right while storing the biggest number we have seen on the variable biggestSoFar. If we happen to fi
The basic idea is to iterate through the array from left to right while storing the biggest number we have seen on the variable biggestSoFar. If we happen to find a bigger number than biggestSoFar, than set said number to biggestSoFar and reset streak to 1. Else, we increment streak by 1. If streak is equal to k, return biggestSoFar.\n```\nclass Solution {\npublic:\n    int getWinner(vector<int>& arr, int k) {\n        int streak = 0;\n        int biggestSoFar = arr[0];\n        for(int i = 1; i < arr.size(); ++i){\n            if(biggestSoFar > arr[i]){\n                streak++;\n            }else{\n                biggestSoFar = arr[i];\n                streak = 1;\n            }\n            if(streak == k) return biggestSoFar;\n        }\n        return biggestSoFar;\n    }\n};\n```
['C', 'C++']