You are viewing a single comment's thread. Return to all comments →
Simple JavaScript/NodeJs solution:
function miniMaxSum(arr) { // Write your code here let min = arr[0]; let max = arr[0]; let totalArrSum = 0;
for (let i = 0; i < arr.length; i++) { totalArrSum += arr[i]; if (arr[i] < min) { min = arr[i]; } if (arr[i] > max) { max = arr[i]; } } console.log(``${totalArrSum - max} $`{totalArrSum - min}`);
}
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
Simple JavaScript/NodeJs solution:
function miniMaxSum(arr) { // Write your code here let min = arr[0]; let max = arr[0]; let totalArrSum = 0;
}