输入两个链表,找出它们的第一个公共结点。
1 # -*- coding:utf-8 -*- 2 # class ListNode: 3 # def __init__(self, x): 4 # self.val = x 5 # self.next = None 6 class Solution: 7 def FindFirstCommonNode(self, pHead1, pHead2): 8 l1 = pHead1 9 l2 = pHead2 10 while l1 != l2: 11 l1 = pHead2 if l1 == None else l1.next 12 l2 = pHead1 if l2 == None else l2.next 13 return l1 14 # write code here