diff --git a/problems/0102.二叉树的层序遍历.md b/problems/0102.二叉树的层序遍历.md index 15d00af2..d0f584fe 100644 --- a/problems/0102.二叉树的层序遍历.md +++ b/problems/0102.二叉树的层序遍历.md @@ -1078,16 +1078,17 @@ class Solution { public List largestValues(TreeNode root) { Queue queue = new LinkedList(); List result = new ArrayList<>(); - if (root!=null) queue.add(root); + if (root != null) queue.add(root); + while(!queue.isEmpty()){ int size = queue.size(); int max = Integer.MIN_VALUE; // 初始化为最小值 - for(int i=0;i