Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
There is no difference between the purpose of k1 and k2. Adding +1 to one element in nums1 is same as performing -1 to one element in nums2, and vice versa.
Reduce the sum of squared difference greedily. One operation of k should use the index that has the current maximum difference.
Binary search the maximum difference for the final result.