Please correct the Memory Limit Exceeded Error for python

  • 0

    I have following code, which passed all the 42 cases but did not get accepted because of memory limit exceeded Error, which I believe is a mistake. It just uses O(1) memory here.

    class Solution(object):
        def getIntersectionNode(self, headA, headB):
            :type head1, head1: ListNode
            :rtype: ListNode
            a, b = headA, headB
            if not a or not b:
                return None
            while a != b:
                a = if a else headB
                b = if b else headA
            return a

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.