Leetcode 3066. Minimum Operations to Exceed Threshold Value II
Repeatedly take the two smallest elements x and y and replace them with (2*min(x,y) + max(x,y)); return the minimum number of such greedy merges needed so that every element in nums is at least k. This is a classic priority-queue (min-heap) greedy problem: always combine the two smallest until the smallest value reaches k.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.