Interview-code-practice-python icon indicating copy to clipboard operation
Interview-code-practice-python copied to clipboard

无环链表相交 解法太复杂

Open zqiang3 opened this issue 6 years ago • 1 comments

zqiang3 avatar Jun 01 '19 02:06 zqiang3

class Solution(object):
    def getIntersectionNode(self, headA, headB):   
                
        cura, curb = headA, headB
        
        while cura is not curb:
            cura = cura.next if cura else headB
            curb = curb.next if curb else headA
                                
        return cura

zqiang3 avatar Jun 01 '19 02:06 zqiang3