You are viewing a single comment's thread. Return to all comments →
C++ solution :
int maximumToys(vector<int> prices, int k) { sort(prices.begin(), prices.end()); int i=0; while(k>0) k-=prices[i++]; return i-1; }
Seems like cookies are disabled on this browser, please enable them to open this website
Mark and Toys
You are viewing a single comment's thread. Return to all comments →
C++ solution :