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.
functionminiMaxSum(arr:number[]):void{// Write your code hereletmin=Infinity,max=-Infinity,totalSum=0;for(leti=0;i<arr.length;i++){constcurrent=arr[i];totalSum+=current;if(current>max){max=current;}if(current<min){min=current;}}console.log(totalSum-max,totalSum-min)}
Cookie support is required to access HackerRank
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 →