#3091
Apply Operations to Make Sum of Array Greater Than or Equal to k
specialist · 965 · lc medium +32 · 44.2% accepted · 171 likes · top 26%
Description
Given a positive integer k, start with the array nums = [1]. You may perform any mix of two operations any number of times: increment any element by 1, or duplicate any element and append the copy. Return the minimum total operations needed so the array sum reaches at least k.
Code
1
2
3