HackerEarth Minimize nodes problem solution - TheCScience