3422. Minimum Operations to Make Subarray Elements Equal
You are given an integer array
nums
and an integerk
. You can perform the following operation any number of times:
- Increase or decrease any element of
nums
by 1.Return the minimum number of operations required to ensure that at least one
subarray
of size
k
innums
has all elements equal.
go
1 | package main |