先序遍历

This commit is contained in:
whai 2024-01-14 22:08:17 +08:00
parent daeea3e734
commit 5c7137c125

View File

@ -50,8 +50,6 @@ public class LeetCode144 {
} }
class Solution1 { class Solution1 {
public List<Integer> preorderTraversal(TreeNode root) { public List<Integer> preorderTraversal(TreeNode root) {
List<Integer> res = new LinkedList<Integer>(); List<Integer> res = new LinkedList<Integer>();
if (root == null) { if (root == null) {