Minimum Sum After K Halvings

Asked at Oracle · Coding Questions · Difficulty: Medium · Last asked Aug 6, 2025

You are given an array `nums` of non-negative integers and an integer `k`. In one operation you choose an index `i` and replace `nums[i]` with `ceil(nums[i] / 2)`, rounding up. You may perform at most `k` operations, and you may pick the same index more than once. Return the smallest possible sum of the array after your operations.

Loading the problem…