Given two integer arrays of the same length, pairing the numbers one by one, calculating the product of each pair of numbers, then summing, calculating the pairing mode with the smallest sum, and printing the sum.

given two arrays of integers of the same length, pair the numbers one by one, calculate the product of each pair of numbers, then sum, calculate the pairing mode with the smallest sum, and print the sum.

input example:

[1jue 2jue 3], [1Jing 2jue 3]

output example:

10

Mar.05,2021

let arr1 = [1, 2, 3, 4];
let arr2 = [1, 2, 3, 4];

arr1 = arr1.sort((a, b) => a - b);
arr2 = arr2.sort((a, b) => b - a);

let min = 0;
for (let i = 0; i < arr1.length; iPP) {
    min += arr1[i] * arr2[i]
}

console.log(min);

you don't need one by one, right?

Menu