很浪漫的代码:大胆地往前走,我们都是对方的退路。
class Solution:
def FindFirstCommonNode(self , pHead1 , pHead2 ):
# write code here
mark1,mark2=pHead1,pHead2
while mark1!=mark2:
mark1=mark1.next if mark1 else pHead2
mark2=mark2.next if mark2 else pHead1
else:
return mark1
return None