You are given two integer arrays nums1 and nums2 of length n, alongside an integer k.
In a single operation, you can choose two indices i and j where i, j n, increment nums1[i] by k, and decrement nums1[j] by k.
Return the minimum number of operations needed to make nums1 identical to nums2. If it is impossible to make both arrays equal, return
Note: Two arrays are considered equal if
nums1[i] == nums2[i]for allin.
Constraints:
n nums1.length nums2.length
n
nums1[i], nums2[j]
k
You are given two integer arrays nums1 and nums2 of length n, alongside an integer k.
In a single operation, you can choose two indices i and j where i, j n, increment nums1[i] by k, and decrement nums1[j] by k.
Return the minimum number of operations needed to make nums1 identical to nums2. If it is impossible to make both arrays equal, return
Note: Two arrays are considered equal if
nums1[i] == nums2[i]for allin.
Constraints:
n nums1.length nums2.length
n
nums1[i], nums2[j]
k