← Questions
Intersection of two linked lists that may have cycles
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given the heads of two singly linked lists, each of which may or may not contain a cycle, decide whether they share a node and return the first shared node. Find where each list's cycle starts (Floyd's algorithm). If neither has a cycle, use the usual length-difference method; if only one does, they cannot meet; if both do, they share the cycle only if one cycle entry can be reached from the other.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
