#include<iostream>
#include<map>
using namespace std;

int helper(const int a[],const int n)
{
  map<int,int> m;
  for(int i = 0;i<n;i++)
   m[a[i]]++;
  map<int,int>::iterator comp = m.begin();
  for( map<int,int>::iterator it = comp;it != m.end();it++)
      if(comp->second < it->second)
      comp = it;
  return comp->second;
}

int main()
{
    int a[] = {1,2,3,4,4,4,5,5,5,5,6};
    cout<<helper(a,sizeof(a)/sizeof(a[0]));
}

 

相关文章:

  • 2022-01-05
  • 2021-12-16
  • 2022-12-23
  • 2022-02-01
  • 2022-01-19
  • 2022-12-23
  • 2021-08-25
  • 2021-05-27
猜你喜欢
  • 2021-11-29
  • 2022-02-07
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
相关资源
相似解决方案