Minimum Sum 10

  • + 1 comment
    import heapq
    def minSum(num, k):
        num1 = [-i for i in num]
        heapq.heapify(num1)
        m = heapq.heappop(num1)
        for i in range(k):
            m = heapq.heappushpop(num1, m//2)
        return -1*(sum(num1)+m)