HackerEarth Dorsplen problem solution - TheCScience