We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
function miniMaxSum(arr) {
arr.sort((a, b) => a - b);
let min = arr.slice(0, arr.length - 1).reduce((a,b) => a+b)
let max = arr.slice(1).reduce((a,b) => a+b)
console.log(min, max)
}
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
JavaScript is kinda cheating