Created
March 16, 2023 11:32
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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