Pergunta de entrevista da empresa X

Its was Hackrank coding challenge