subject : Enter two linked lists , Find their first common node .
Many versions of code (leetcode) yes :
def getIntersectionNode(self, headA, headB):
if headA and headB:
A, B = headA, headB
while A!=B:
A = A.next if A else headB
B = B.next if B else headA
return A
If ,A,B No intersection ,A,B The point of intersection of is None, return A or B All possible