HackerEarth Manhattan distance problem solution - TheCScience