Pregunta de entrevista de HackerRank

question on HashMap and Cycle Detection