You are viewing a single comment's thread. Return to all comments →
**Solutions In PHP : ** * Using Loop* function miniMaxSum(array Extra open brace or missing close bracearraySize = count($arr);
// total sum `$totalSum = array_sum($`arr); // maxValue & minValue vars ( for the next logic) `$maxValue = max($`arr); `$minValue = min($`arr); // maxSum & minSum vars `$maxSum = $`minSum = 0; // looping array the calculate maxSim for (`$x = 0; $`x < `$arraySize; $`x++) { `$maxSum += $`arr[$x]; } // looping array the calculate min for (`$x = 0; $`x < `$arraySize; $`x++) { `$minSum += $`arr[$x]; } print `$minSum = $`minSum - $maxValue; print " "; print `$maxSum = $`maxSum - $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 →
**Solutions In PHP : ** * Using Loop* function miniMaxSum(array arraySize = count($arr);