You are viewing a single comment's thread. Return to all comments →
C++:
int equalizeArray(vector<int> v) { sort(v.begin(),v.end()); vector<int> w; int p = v.size(); for(int i=0;i<p;){ int a = count(v.begin(), v.end(), v[i]); w.push_back(a); i=i+a; } int max = *max_element(w.begin(), w.end()); return p-max; }
Seems like cookies are disabled on this browser, please enable them to open this website
Equalize the Array
You are viewing a single comment's thread. Return to all comments →
C++: