Domanda di colloquio di Thoughtworks

Find intersection and cycle in a linked list.

Risposta di colloquio

Anonimo

10 set 2021

For finding the intersection of the linked list, I gave 2 approaches. One was a naive approach with O(N^2) complexity and another by reversing both the linked list and finding the intersection. For finding cycle, I used Floyd's Cycle Finding Algorithm.

1