You are viewing a single comment's thread. Return to all comments →
C++ solution :
int toys(vector<int> w) { sort(w.begin(), w.end()); int i=0, count=0, base; while(i!=w.size()) { count++; base = w[i]; while(i!=w.size() && w[i]<=base+4) i++; if (i==w.size()) break; } return count; }
Priyanka and Toys
You are viewing a single comment's thread. Return to all comments →
C++ solution :