Hackerrank – Max Min

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
Sort the given array ascending. Make k parts of the array. Calculate unfairness as difference between last element and first element for all k subarrays. Select the minimum unfairness.

Formerly it was called Angry Children.

I created solution in:

All solutions are also available on my GitHub.

Ruby

Java

JavaScript

Scala