You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/Es5l0jbSH9I
int toys(vector<int> w) { sort(w.begin(), w.end()); int result = 1, mi = w[0]; for(int item: w){ if(item > mi + 4){ mi = item; result++; } } return result; }
Seems like cookies are disabled on this browser, please enable them to open this website
Priyanka and Toys
You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/Es5l0jbSH9I