HackerEarth Max Power problem solution - TheCScience