https://drive.google.com/drive/u/0/folders/1rHeA70oqU5kvGD5APwFRrMouMqgOy18s
class Solution {
public:
bool ceck(TreeNode* root,long lmax,long rmin){
if(root==NULL) return true;
//if(root->left==NULL && root->right==NULL) return true;
bool l=ceck(root->left,lmax,root->val); // lmax < root->val << rmin
if(root->val <= lmax) return false;
if(root->val >= rmin) return false;
bool r=ceck(root->right,root->val,rmin);
return l&r;
}
bool isValidBST(TreeNode* root) {
bool res =ceck(root,LONG_MIN,LONG_MAX);
return res;
}
};