You are viewing a single comment's thread. Return to all comments →
Nice, here's a one-liner based off your solution:
def getMinimumCost(k, c): return sum([cost * ((i // k) + 1) for i, cost in enumerate(sorted(c, reverse=True))])
Greedy Florist
You are viewing a single comment's thread. Return to all comments →
Nice, here's a one-liner based off your solution: