两行代码
public class Solution { public int TreeDepth(TreeNode root) { if (root == null) return 0; return 1 + Math.max(TreeDepth(root.left), TreeDepth(root.right)); }
两行代码
public class Solution { public int TreeDepth(TreeNode root) { if (root == null) return 0; return 1 + Math.max(TreeDepth(root.left), TreeDepth(root.right)); }