HackerEarth Factors problem solution - TheCScience