You are viewing a single comment's thread. Return to all comments →
C#
int maximumToys(List<int> prices, int k) { prices.Sort(); int result = 0, iterator = 0; while (k > 0 && prices[iterator] <= k) { k -= prices[iterator]; result++; iterator++; } return result; }
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#