Why MLE? Seriously?

  • 0

    I've heard that google use this question in one of their phone screen interviews, so I thought I practiced again. Same code got MLE.

    This is O(1) space guaranteed. I tried many times still fail. Don't know what's happening

    def getIntersectionNode(self, headA, headB):
        tmpA, tmpB = headA, headB
        lenA, lenB = 0, 0
        while tmpA:
            tmpA = tmpA.next
            lenA += 1
        while tmpB:
            tmpB = tmpB.next
            lenB += 1
        while lenA > lenB:
            lenA -= 1
            headA = headA.next
        while lenB > lenA:
            lenB -= 1
            headB = headB.next
        if headA == headB: return headA
        while (headA != None and headB != None) and headA != headB:
            headA = headA.next
            headB = headB.next
        return headA


  • 0

    Probably system crashdown?

    I tried a better solution from here: https://discuss.leetcode.com/topic/13419/concise-python-code-with-comments/4

    still got TLE...

    I am wondering if the memory limit allocated to a person is set to be within a range per day...
    I tried many other questions today...

Log in to reply

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