HackerEarth A Game of Numbers problem solution