From 300f4a32d115c6b28ccbbbf664acf2a2471b65a1 Mon Sep 17 00:00:00 2001 From: ironartisan <54694467+ironartisan@users.noreply.github.com> Date: Tue, 7 Sep 2021 10:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B00530.=E4=BA=8C=E5=8F=89?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A0=91=E7=9A=84=E6=9C=80=E5=B0=8F=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E5=80=BC=E5=B7=AE.md=E8=BF=AD=E4=BB=A3Java=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0530.二叉搜索树的最小绝对差.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/problems/0530.二叉搜索树的最小绝对差.md b/problems/0530.二叉搜索树的最小绝对差.md index db2ca2d4..b19a0dd2 100644 --- a/problems/0530.二叉搜索树的最小绝对差.md +++ b/problems/0530.二叉搜索树的最小绝对差.md @@ -184,15 +184,15 @@ class Solution { int result = Integer.MAX_VALUE; while (cur != null || !stack.isEmpty()) { if (cur != null) { - stack.push(cur); - cur = cur.left; // 左节点入栈 + stack.push(cur); // 将访问的节点放进栈 + cur = cur.left; // 左 }else { - cur = stack.pop(); // 右节点入栈 - if (pre != null) { + cur = stack.pop(); + if (pre != null) { // 中 result = Math.min(result, cur.val - pre.val); } pre = cur; - cur = cur.right; + cur = cur.right; // 右 } } return result;