For each cyclic shift of num1, calculate the sum of absolute differences with num2
For each cyclic shift of num1, calculate the sum of absolute differences with num2 Question: num1 = [1, 4, 2, 11] num2 = [10, 1, 8, 4] The output should be solution(arr1, arr2) = 7. Explanation: Let’s consider all possible cyclic shifts of num1: The first shift is [1, 4, 2, 11], and the sum …
Total answers: 3