• 104.Maximum Depth of Binary Tree


     

    # Definition for a binary tree node.
    # class TreeNode:
    #     def __init__(self, x):
    #         self.val = x
    #         self.left = None
    #         self.right = None
    
    class Solution:
        def maxDepth(self, root: TreeNode) -> int:
            if root == None:
                return 0
            return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
  • 相关阅读:
    BD String
    1114
    1083
    1084
    1108
    1087
    1145
    1217
    1164
    反射
  • 原文地址:https://www.cnblogs.com/luo-c/p/12857292.html
Copyright © 2020-2023  润新知