Solving hackerrank challenges