diff --git a/Tree/ValidateBinarySearchTree.swift b/Tree/ValidateBinarySearchTree.swift index 6d3cc937..dd9afe06 100644 --- a/Tree/ValidateBinarySearchTree.swift +++ b/Tree/ValidateBinarySearchTree.swift @@ -21,15 +21,15 @@ class ValidateBinarySearchTree { return _helper(root, nil, nil) } - private func _helper(node: TreeNode?, _ min: Int?, _ max: Int?) -> Bool { + private func _helper(_ node: TreeNode?, _ min: Int?, _ max: Int?) -> Bool { guard let node = node else { return true } - if let min = min, root.val <= min { + if let min = min, node.val <= min { return false } - if let max = max, root.val >= max { + if let max = max, node.val >= max { return false }