Untitled
unknown
c_cpp
a year ago
325 B
10
Indexable
/*
a = [2 3 4 2 2 ]
map<int, int>m;
for (int x : a) m[x]++
2 - 3
4 - 3
3 - 1
4 - 1
pair<int, int> maxFre = *m.begin()
for (auto p : m) {
if (p.second > max.second) maxFre = p
}
for (int i = 0; i < n; ++i) {
if (m[a[i]] == maxFre.second) {
cout << a[i] << ' ' << m[a[i]];
break;
}
}
*/Editor is loading...
Leave a Comment