From 07d27158b238812f603f250794b9a681f71e7f8e Mon Sep 17 00:00:00 2001 From: binglu18 <57309010+binglu18@users.noreply.github.com> Date: Fri, 20 Aug 2021 16:10:24 +0800 Subject: [PATCH] =?UTF-8?q?update=200102.=E4=BA=8C=E5=8F=89=E6=A0=91?= =?UTF-8?q?=E7=9A=84=E5=B1=82=E5=BA=8F=E9=81=8D=E5=8E=86.md=20515java?= =?UTF-8?q?=E8=A7=A3=E6=B3=95=E4=BA=8Cformat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0102.二叉树的层序遍历.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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