You are viewing a single comment's thread. Return to all comments →
Nice logic. but, I did it in some different way:
sort(arr.begin(),arr.end()); reverse(arr.begin(), arr.end()); while(!arr.empty()){ cout<<arr.size()<<endl; for(int i = 0; i<arr.size();++i) arr[i]-=arr[arr.size()-1]; while(arr.back() ==0 && !arr.empty()) arr.pop_back(); }
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
Nice logic. but, I did it in some different way: