class Solution {
public:
int majorityElement(vector<int>& nums) {
int count =0 ;
int current =0 ;
for(int it : nums ){
if(count == 0){
current = it;
}
count += (it == current )? 1 : -1;
}
return current;
}
};
https://leetcode.com/problems/majority-element/
https://takeuforward.org/data-structure/find-the-majority-element-that-occurs-more-than-n-2-times/