You are viewing a single comment's thread. Return to all comments →
function miniMaxSum(arr: number[]): void { let totalSum = 0; let minValue = Infinity; let maxValue = -Infinity;
for (const num of arr){ totalSum += num; if(num < minValue){ minValue = num; } if(num > maxValue){ maxValue = num; } } console.log(``${totalSum - maxValue} $`{totalSum - minValue}`)
}
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 →
function miniMaxSum(arr: number[]): void { let totalSum = 0; let minValue = Infinity; let maxValue = -Infinity;
}