标签:超过 hal for 超过一半 code map 数组 arm more
int NumberAppearMoreThanOneHalf(vactor
{
if (numbers.empty==0)
{
return 0;
}
map<int, int> m;
for(int i=0; i<numbers.size(); ++i)
{
++m[numbers[i]];
}
for(auto member:m)
{
int size = numbers.size();
if(member.second > size/2)
{
return member.first;
}
}
return 0;
}
标签:超过 hal for 超过一半 code map 数组 arm more
原文地址:https://www.cnblogs.com/xjyxp/p/11451741.html