// 根据左右子树的取值范围
class Solution {
public:
bool isValidBST(TreeNode root) {
return dfs(root,INT_MIN,INT_MAX);
}
bool dfs(TreeNode root,long long min_num,long long max_num)
{
if(!root) return true;
if(root->val[HTML_REMOVED]val>max_num) return false;
return dfs(root->left,min_num,root->val-1ll)&&dfs(root->right,root->val+1ll,max_num);
}
};