Description
Submission
class Solution { public: int findSpecialInteger(vector<int>& arr) { int target = arr.size() / 4 + 1; arr.insert(arr.begin(), INT_MAX / 2); int n = arr.size(); int cnt = 0; int ret = 0; for(int i = 1; i < n; ++i) { if(arr[i] != arr[i-1]) { if(cnt >= target) return arr[i-1]; cnt = 0; } else cnt++; } return arr[n-1]; } };