Why i can AC in Binary Tree Level Order Traversal but get RE in Binary Tree Level Order Traversal 2


  • 0
    J

    e      class Solution:
    # @param {TreeNode} root
    # @return {integer[][]}
    def levelOrder(self, root):
        res,next = [],[]
        if root:
            temp = [root]
        else:
            return res
        res.append(temp)
        while 1:
            for v in temp:
                if v.left:
                    next.append(v.left)
                if v.right:
                    next.append(v.right)
            if not next:
                break
            res.append(next)
            temp = next
            next= []
        q=[[v.val for v in x] for x in res]
        return q[::-1]            here
    

    i get Line 42: AttributeError: Solution instance has no attribute 'levelOrderBottom'


Log in to reply
 

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