Please add check for [9,9,7,6,5]. Should be 0, but the algorithm of pushing back the difference between 2 largest elements, proposed by moozii, fails and returns 4.
43