Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 0111.二叉树的最小深度.md / Fix typo #2533

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions problems/0111.二叉树的最小深度.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

代码如下:

```
```CPP
int getDepth(TreeNode* node)
```

Expand All @@ -74,14 +74,14 @@ int getDepth(TreeNode* node)

代码如下:

```
```CPP
if (node == NULL) return 0;
```

3. 确定单层递归的逻辑

这块和求最大深度可就不一样了,一些同学可能会写如下代码:
```
```CPP
int leftDepth = getDepth(node->left);
int rightDepth = getDepth(node->right);
int result = 1 + min(leftDepth, rightDepth);
Expand Down