Question d'entretien d'embauche Given the head of a linked li... |

Question d'entretien d'embauche

Entretien de Internship(Candidat étudiant) Mumbai (Inde)

Given the head of a linked list, can you find if it

  contains a cycle in it?

Réponse de l'entretien

1 réponse


I knew this question before. The answer is to have two pointers and move one of them at double the rate of other. If they meet at some point of time then there is a cycle. Otherwise, no cycle exists

Candidat à l'entretien, le 30 oct. 2015

Ajouter des réponses ou des commentaires

Pour commenter ceci, se connecter ou s'inscrire