You are viewing a single comment's thread. Return to all comments →
Straigthforward python solution:
def maximumToys(prices, k):
sorted_prices = sorted(prices) cost = 0 for i in range(len(prices)): cost += sorted_prices[i] if cost > k: return i
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 →
Straigthforward python solution:
def maximumToys(prices, k):