You are viewing a single comment's thread. Return to all comments →
def getMinimumCost(n, k, c): cost = 0 c = sorted(c, reverse=True) for i in range(0, n): cost += (i // k + 1) * c[i] return cost
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 →