Given an array of integers and an integer k, perform exactly k operations (remove an element, divide it by 2 and take the ceiling, add it back) to minimize the sum. Return the minimum possible sum.
Asked in the DSA round 1 stage.
Implement def minimize_sum(nums, k):, where nums is a list of non-negative integers and k is a non-negative integer. Return the minimum possible integer sum after exactly k operations. An element may be selected repeatedly. Use a max heap to efficiently select the current largest value.
def minimize_sum(nums, k):