if the two have intersection, then they must have the same tail from end.
so the fisrt step is to reverse the linkedlist, then scan from the reversed two util they have different value, like 5 in headA and 4 in headB.
but i think my idea is a little complex for python doing it.
wish it could get you some tips. disccusstion is welcomed!
why do that have to have the same tail end?
these intersect on c1,c2 but have different tail ends
the Question is said that:
"Write a program to find the node at which the intersection of two singly linked lists begins."
I tried a similar approach, however, OJ tell me that you can't modify the structure of link list
you modifyed the structure of list ? no way ... how could it be..
must somewhere wrong.
i will give a try then share my code.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.