HackerEarth Maximize Array Sum problem solution - TheCScience