Skip to content

Commit 3340863

Browse files
author
Yi Gu
committed
[Tree] Optimize solution to Validate Binary Search Tree
1 parent ae1443c commit 3340863

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: Tree/ValidateBinarySearchTree.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class ValidateBinarySearchTree {
2626
return true
2727
}
2828

29-
if min != nil && node.val <= min {
29+
if let min = min, root.val <= min {
3030
return false
3131
}
32-
if max != nil && node.val >= max {
32+
if let max = max, root.val >= max {
3333
return false
3434
}
3535

0 commit comments

Comments
 (0)