#3824
Minimum K to Reduce Array Within Limit
expert · 1005 · lc medium +32 · 41.1% accepted · 61 likes · top 21%
Description
Given a positive integer array nums, define nonPositive(nums, k) as the fewest operations needed to make every element non-positive, where each operation picks an index i and subtracts k from nums[i]. Return the smallest positive integer k for which nonPositive(nums, k) <= k2.
Code
1
2
3