Beautify Python solution from Wikipedia


  • 0
    S

    '''
    class Solution(object):
    def inorderTraversal(self, root):

        stack = []
        result = []
        
        while stack or root:
            if root:
                stack.append(root)
                root = root.left
            else:
                top = stack.pop()
                result.append(top.val)
                root = top.right
            
        return result
    

    '''


Log in to reply
 

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