Mini-Max Sum
Solutions This easy challenge has, actually, an interesting generalization.
The problem can be quickly solved by noting that the number of elements to select is one less (4) than the length of the input array (5). So we can just sum all the numbers and subtract the result to the max and to the min of the array. The domain is subject to overflow so we have to use a 64-bit integer:
[Read More]