Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from youngyangyang04:master #12

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

Merged
pull merged 18 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jun 12, 2022
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8030165
添加 515.在每个树行中找最大值 Scala版本
wzqwtt May 19, 2022
a317949
添加 116.填充每个节点的下一个右侧节点指针 Scala版本
wzqwtt May 19, 2022
7a62a75
添加 117.填充每个节点的下一个右侧节点指针II Scala版本
wzqwtt May 19, 2022
32f0599
添加 104.二叉树的最大深度 Scala版本
wzqwtt May 19, 2022
f5c5a58
添加 111.二叉树的最小深度 Scala版本
wzqwtt May 19, 2022
afcf6cd
添加(0718.最长重复子数组.md):增加typescript版本
xiaofei-2020 May 19, 2022
a4b0247
添加0704.二分查找 Kotlin版本
Mrxulovemingming May 19, 2022
6177934
Merge branch 'youngyangyang04:master' into master
Mrxulovemingming May 21, 2022
3de2992
添加0027.移除元素 Kotlin版本
Mrxulovemingming May 21, 2022
b57842d
Merge branch 'youngyangyang04:master' into master
Mrxulovemingming May 22, 2022
10b440e
添加0977.有序数组的平方 Kotlin版本
Mrxulovemingming May 23, 2022
35666ef
Merge branch 'youngyangyang04:master' into master
Mrxulovemingming May 25, 2022
2b434d0
Merge branch 'master' into master
Mrxulovemingming May 28, 2022
770c230
Merge pull request #1353 from wzqwtt/tree04
youngyangyang04 Jun 11, 2022
8156c35
Merge pull request #1354 from wzqwtt/tree05
youngyangyang04 Jun 11, 2022
0ffffe0
Merge pull request #1355 from xiaofei-2020/dp43
youngyangyang04 Jun 11, 2022
b37c3e0
Merge branch 'master' into master
youngyangyang04 Jun 11, 2022
a6ce79a
Merge pull request #1357 from Mrxulovemingming/master
youngyangyang04 Jun 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
添加 104.二叉树的最大深度 Scala版本
  • Loading branch information
wzqwtt committed May 19, 2022
commit 32f0599243e7e9585a9b18a8b36fa0e50f120a24
24 changes: 24 additions & 0 deletions problems/0102.二叉树的层序遍历.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,30 @@ func maxDepth(_ root: TreeNode?) -> Int {
}
```

Scala:
```scala
// 104.二叉树的最大深度
object Solution {
import scala.collection.mutable
def maxDepth(root: TreeNode): Int = {
if (root == null) return 0
val queue = mutable.Queue[TreeNode]()
queue.enqueue(root)
var depth = 0
while (!queue.isEmpty) {
val len = queue.length
depth += 1
for (i <- 0 until len) {
val curNode = queue.dequeue()
if (curNode.left != null) queue.enqueue(curNode.left)
if (curNode.right != null) queue.enqueue(curNode.right)
}
}
depth
}
}
```

# 111.二叉树的最小深度

[力扣题目链接](https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/)
Expand Down

AltStyle によって変換されたページ (->オリジナル) /