Pergunta de entrevista da empresa HackerRank

question on HashMap and Cycle Detection