HackerEarth Eating apples problem solution - TheCScience