@laigary.com~/interview/coding/1962-remove-stones-t….md$
$ cat ./coding/1962-remove-stones-to-minimize-the-total.md
[Coding]·2025-03-30·1 min read

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])