$ 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