HackerEarth Toy Box problem solution - TheCScience