HackerEarth Mobile Selection problem solution - TheCScience