Skip to content

Commit 3ab1cc5

Browse files
committed
merge left tree result and right tree result
1 parent 2e8dbf7 commit 3ab1cc5

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

validate-binary-search-tree/PDKhan.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ class Solution {
77
if(root->val <= min || root->val >= max)
88
return false;
99

10-
if(search(root->left, min, root->val) == false)
11-
return false;
12-
13-
if(search(root->right, root->val, max) == false)
14-
return false;
15-
16-
return true;
10+
return search(root->left, min, root->val) && search(root->right, root->val, max);
1711
}
1812

1913
bool isValidBST(TreeNode* root) {

0 commit comments

Comments
 (0)