mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-30 07:33:45 +00:00
Update 55.1 二叉树的深度.md
题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 55.1 二叉树的深度
|
||||
|
||||
[NowCoder](https://www.nowcoder.com/practice/435fb86331474282a3499955f0a41e8b?tpId=13&tqId=11191&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
|
||||
[Leetcode](https://leetcode.cn/problems/er-cha-shu-de-shen-du-lcof/)
|
||||
|
||||
## 题目描述
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
## 解题思路
|
||||
|
||||
```java
|
||||
public int TreeDepth(TreeNode root) {
|
||||
return root == null ? 0 : 1 + Math.max(TreeDepth(root.left), TreeDepth(root.right));
|
||||
public int calculateDepth(TreeNode root) {
|
||||
return root == null ? 0 : 1 + Math.max(calculateDepth(root.left), calculateDepth(root.right));
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user