class Solution { public: int MoreThanHalfNum_Solution(vector<int> numbers) { int half = numbers.size() / 2; map<int, int> mp; int maxNumb = 0; for(int i = 0; i < numbers.size(); i++) { mp[numbers[i]]++; if(mp[numbers[i]] > maxNumb) { maxNumb = mp[numbers[i]]; if(mp[numbers[i]] > half) return numbers[i]; } } return 0; } };