gary@interview:~/interview/coding/1962-remove-ston….md$
$ cat ./coding/1962-remove-stones-to-minimize-the-total.md
[Coding]

1962. Remove Stones to Minimize the Total

────────────────────────────────────────────────────────────

1962. Remove Stones to Minimize the Total

class Solution:
    def minStoneSum(self, piles: List[int], k: int) -> int:
        heap = []
        for pile in piles:
            heapq.heappush(heap, -pile)
        
        while k > 0:
            top = heapq.heappop(heap)
            heapq.heappush(heap, floor(top / 2))
            k -= 1
        
        return sum([-pile for pile in heap])
--tags#Heap
$ ls ./coding/ | grep -v 1962-remove-stones-to-minimize-the-total
265. Paint House II256. Paint House143. Reorder List1762. Buildings With an Ocean View
← cd ../codingcd ~