HackerEarth Exploring ruins problem solution - TheCScience