HackerEarth Destination cost problem solution - TheCScience