diff --git a/notes/55.1 二叉树的深度.md b/notes/55.1 二叉树的深度.md index 3af67c60..d0b2f1f3 100644 --- a/notes/55.1 二叉树的深度.md +++ b/notes/55.1 二叉树的深度.md @@ -10,6 +10,8 @@ ## 解题思路 +树的深度等于左右子树深度的较大值加 1,空树的深度为 0。 + ```java public int calculateDepth(TreeNode root) { return root == null ? 0 : 1 + Math.max(calculateDepth(root.left), calculateDepth(root.right));