mirror of
https://github.com/chefyuan/algorithm-base.git
synced 2025-08-06 07:31:57 +00:00
代码重构 【Github Actions】
This commit is contained in:
@@ -34,7 +34,7 @@ class Solution {
|
||||
TreeNode cur = new TreeNode(-1);
|
||||
cur = root;
|
||||
Stack<TreeNode> stack = new Stack<>();
|
||||
while (!stack.isEmpty() || cur != null) {
|
||||
while (!stack.isEmpty() || cur != null) {
|
||||
//找到当前应该遍历的那个节点
|
||||
while (cur != null) {
|
||||
stack.push(cur);
|
||||
@@ -47,7 +47,7 @@ class Solution {
|
||||
cur = temp.right;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -104,4 +104,4 @@ func inorderTraversal(root *TreeNode) []int {
|
||||
}
|
||||
```
|
||||
|
||||
###
|
||||
###
|
||||
|
Reference in New Issue
Block a user