You are viewing a single comment's thread. Return to all comments →
function maximumToys(prices, k) { const sortedPrices = prices.sort((a, b)=> a-b) let total = 0 let count =0 while((total + sortedPrices[count]) < k){ total +=sortedPrices[count] count++ } return count }
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 →