Simple 4 line code (Python)


  • 0
    L
        def maxDepth(self, root):
            """
            :type root: TreeNode
            :rtype: int
            """
            if root == None :
                return 0
            else :
                return max(1+self.maxDepth(root.left), 1+self.maxDepth(root.right)) ```

Log in to reply
 

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