题目:

题解:
class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int n = nums.size();
vector<int> ans;
unordered_map<int, int> cnt;
for (auto & v : nums) {
cnt[v]++;
}
for (auto & v : cnt) {
if (v.second > n / 3) {
ans.push_back(v.first);
}
}
return ans;
}
};








![开发笔记 | 快速上手[法大大]电子合同SDK使用SpringBoot+JAVA](https://i-blog.csdnimg.cn/direct/9f47a4faf68e416abf4290180f13c5e2.png)










