Maximal Score After Applying K Operations
Medium · Heap & Priority Queue · about 15 minutes
Asked at Google, Amazon, Microsoft, Meta.
You will perform exactly k operations on nums. Each operation picks some index i, adds nums[i] to your score, and then shrinks nums[i] to ceil(nums[i] / 3). What is the highest score you can reach? (In general it needs 64 bits; in these tests it fits in 32.)