From ef0cb5563884ce50c49d8b8e0d43e95073e13172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E6=9E=97=E7=A8=8B=E5=BA=8F=E5=91=98?= Date: Sun, 4 Sep 2022 17:39:00 +0800 Subject: [PATCH] =?UTF-8?q?530.=E4=BA=8C=E5=8F=89=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A0=91=E7=9A=84=E6=9C=80=E5=B0=8F=E7=BB=9D=E5=AF=B9=E5=B7=AE?= =?UTF-8?q?=20python=E8=BF=AD=E4=BB=A3=E6=B3=95=E6=B2=A1=E6=9C=89=E5=8F=96?= =?UTF-8?q?abs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0530.二叉搜索树的最小绝对差.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0530.二叉搜索树的最小绝对差.md b/problems/0530.二叉搜索树的最小绝对差.md index 809f500b..4b70a595 100644 --- a/problems/0530.二叉搜索树的最小绝对差.md +++ b/problems/0530.二叉搜索树的最小绝对差.md @@ -233,7 +233,7 @@ class Solution: else: # 逐一处理节点 cur = stack.pop() if pre: # 当前节点和前节点的值的差值 - result = min(result, cur.val - pre.val) + result = min(result, abs(cur.val - pre.val)) pre = cur cur = cur.right return result