Desquared Interview Question

Balanced sums problem for the algorithmic part