X Interview Question

Its was Hackrank coding challenge