Remove Stones to Minimize the Total
viaLeetCode
Given an array of pile sizes and an integer k, perform k operations; in each operation pick the largest pile and remove half of it (floor(pile/2)) from that pile. Return the minimum possible total sum of stones after k operations. Solve with a max-heap, repeatedly halving the top element.
asked …