Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int equalizeArray(vector<int> arr) {
- map<int, int > mp ;
- for (int i=0 ;i<arr.size();i++){
- mp[arr[i]]++ ;
- }
- int maxVal=-1 ;
- for (auto x: mp){
- if ( x.second >maxVal ){
- maxVal = x.second ;
- }
- }
- return arr.size() - maxVal ;
- }
Advertisement
Add Comment
Please, Sign In to add comment