mirror of
https://github.com/chefyuan/algorithm-base.git
synced 2025-08-07 15:52:12 +00:00
代码重构 【Github Actions】
This commit is contained in:
@@ -49,10 +49,10 @@ class Solution {
|
||||
public List<Integer> preorderTraversal(TreeNode root) {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
Stack<TreeNode> stack = new Stack<>();
|
||||
if (root == null) return list;
|
||||
if (root == null) return list;
|
||||
stack.push(root);
|
||||
while (!stack.isEmpty()) {
|
||||
TreeNode temp = stack.pop();
|
||||
TreeNode temp = stack.pop();
|
||||
if (temp.right != null) {
|
||||
stack.push(temp.right);
|
||||
}
|
||||
|
Reference in New Issue
Block a user