DSA Problems and their solutions.
View the Project on GitHubvaibhavvikas/dsa-problems
def min_min_sum(weights): cost = 0 heapq.heapify(weights) while len(weights) > 1: a = heapq.heappop(weights) b = heapq.heappop(weights) cost += a + b heapq.heappush(weights, a + b) return cost