You are given a arr and an integer k. The array is circular, which means the element immediately following the last element is arr[0], and the element immediately preceding arr[0] is the last element.
In a single operation, you can select any index i and increment or decrement arr[i] by
Return the minimum number of operations required to make the sum of every contiguous subarray of length k equal.
Note: A subarray of length
kstarting at indexiconsists of the elements fromarr[i]up toarr[(i + k - 1) % arr.length].
Constraints:
k arr.length
arr[i]
You are given a arr and an integer k. The array is circular, which means the element immediately following the last element is arr[0], and the element immediately preceding arr[0] is the last element.
In a single operation, you can select any index i and increment or decrement arr[i] by
Return the minimum number of operations required to make the sum of every contiguous subarray of length k equal.
Note: A subarray of length
kstarting at indexiconsists of the elements fromarr[i]up toarr[(i + k - 1) % arr.length].
Constraints:
k arr.length
arr[i]