class Solution(object):
def getIntersectionNode(self, headA, headB):
a, b = headA, headB
while a != b:
a = a.next if a else headB
b = b.next if b else headA
print a
return a
class Solution(object):
def getIntersectionNode(self, headA, headB):
a, b = headA, headB
while a != b:
a = a.next if a else headB
b = b.next if b else headA
print a
return a
本文标题:leetcode 160. 相交链表
本文链接:https://www.haomeiwen.com/subject/smuifltx.html
网友评论