You are viewing a single comment's thread. Return to all comments →
javascript 1-liner implementation:
function getMinimumCost(k, c) { return c.sort((a, b) => b - a).reduce((acc, cost, index) => acc + (parseInt(index / k) + 1) * cost, 0) }
Seems like cookies are disabled on this browser, please enable them to open this website
Greedy Florist
You are viewing a single comment's thread. Return to all comments →
javascript 1-liner implementation: