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?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eab101-2025.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eab101-2025.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?