You are viewing a single comment's thread. Return to all comments →
This is my c++ solution of this problem, you can watch the explanation here : https://youtu.be/jZPhE_MTkVg
vector<int> cutTheSticks(vector<int> arr) { sort(arr.begin(), arr.end()); vector<int>result(1, arr.size()); for(int i = 1; i < arr.size(); i++){ if(arr[i-1] != arr[i]) result.push_back(arr.size() - i); } return result; }
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
This is my c++ solution of this problem, you can watch the explanation here : https://youtu.be/jZPhE_MTkVg