C++简答代码/hashmap/4行:

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