Web14 jul. 2024 · As you can see, the minimal sum is 1+2+3+4=10 and the maximal sum is 2+3+4+5=14. Thus, we print these minimal and maximal sums as two space-separated … Web22 apr. 2024 · my solution: let sumValue = arr.reduce ( (a, b) => { return a + b; }); const min = sumValue - Math.max (...arr); const max = sumValue - Math.min (...arr); const result = `$ {min} $ {max}` console.log (result); Share Improve this answer Follow answered Oct 9, 2024 at 12:43 henrique_ms 191 2 5 Add a comment 1
Mini-Max Sum Hackerrank Solution - java 8 Hackerrank …
Web22 dec. 2016 · Hackerrank – Problem Statement. A description of the problem can be found on Hackerrank. Solution. If you order the given array ascending – the min sum are first n-1 elements – the max sum are last n-1 elements. I created solution in: Scala; Java; JavaScript; Ruby; All solutions are also available on my GitHub. Java Web8 mei 2024 · MINI-MAX SUM (HackerRank) QUESTION. Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective ... dr nath pulmonology
Mini-Max Sum Solution in Kotlin -HackerRank - Medium
Web10 dec. 2024 · void miniMaxSum (vector arr) { // LLONG_MAX --> set min to the highest value in long long // LLONG_MIN --> set max to the lowest value in long long but why lowest value ? because you want highest value long long min = LLONG_MAX , max = LLONG_MIN , sum ; for (int i = 0 ;i max) max = sum; if (sum < min) min = sum; } cout << min << " " … Web8 nov. 2024 · Mini-Max Sum Solution in Kotlin -HackerRank Problem Given five positive integers, find the minimum and maximum values that can be calculated by summing … Web19 jul. 2024 · Mini-Max Sum HackerRank solution in Java July 19, 2024 Find the minimum and maximum values that can be calculated by summing exactly four of the five integers Problem Description : Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. dr nath pulmonologist