HackerEarth Number of overtakes problem solution - TheCScience