• + 0 comments

    Python Code

    def findMergeNode(head1, head2):
        l1, l2 = head1, head2
        dummy = {}
        while l1:
            dummy[id(l1)] = l1.data
            l1=l1.next
        while l2:
            if id(l2) in dummy:
                return dummy[id(l2)]
            else:
                l2=l2.next