Question d'entretien d'embauche Housing.com: Given the head of a linked li... | Glassdoor.fr

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épondre

Réponse de l'entretien

1 réponse

0

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