HackerEarth Friendly Neighbors problem solution - TheCScience