Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Solution::repeatedNumber(const vector<int> &A) {
- int n=A.size();
- n/=3;
- map<int,int> m;
- for(auto x:A)
- {
- m[x]++;
- if(m[x]>n)
- return x;
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement