2919. Minimum Increment Operations to Make Array Beautiful
You are given a 0-indexed integer array
numshaving lengthn, and an integerk.You can perform the following increment operation any number of times (including zero):
- Choose an index
iin the range[0, n - 1], and increasenums[i]by1.An array is considered beautiful if, for any subarray with a size of
3or more, its maximum element is greater than or equal tok.Return an integer denoting the minimum number of increment operations needed to make
nums*beautiful.*A subarray is a contiguous non-empty sequence of elements within an array.