Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a5723e1

Browse files
Merge pull request youngyangyang04#1625 from jishan7/master
530.二叉搜索树的最小绝对差 python迭代法没有取abs
2 parents e75c4b0 + ef0cb55 commit a5723e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎problems/0530.二叉搜索树的最小绝对差.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class Solution:
233233
else: # 逐一处理节点
234234
cur = stack.pop()
235235
if pre: # 当前节点和前节点的值的差值
236-
result = min(result, cur.val - pre.val)
236+
result = min(result, abs(cur.val - pre.val))
237237
pre = cur
238238
cur = cur.right
239239
return result

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /