Skip to content

Instantly share code, notes, and snippets.

@Nasah-Kuma
Created March 16, 2023 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nasah-Kuma/9c1b0fffaf9135e694b1393289f3908d to your computer and use it in GitHub Desktop.
Save Nasah-Kuma/9c1b0fffaf9135e694b1393289f3908d to your computer and use it in GitHub Desktop.
Solution to HackerRank's Mini-max-sum challenge: https://www.hackerrank.com/challenges/mini-max-sum/problem?isFullScreen=true
/*
* Complete the 'miniMaxSum' function below.
*
* The function accepts INTEGER_ARRAY arr as parameter.
*/
function miniMaxSum(arr) {
// Write your code here
arr.sort();
console.log(arr[0]+arr[1]+arr[2]+arr[3], arr[1]+arr[2]+arr[3]+arr[4]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment