/*
* @lc app=leetcode.cn id=98 lang=javascript
*
* [98] 验证二叉搜索树
*/
// @lc code=start
/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
* }
*/
/**
* @param {TreeNode} root
* @return {boolean}
*/
let verifyBST = (root,min,max) =>{
if(!root) return true;
if(root.val>=max || root.val<=min) return false;
return verifyBST(root.left,min,root.val) && verifyBST(root.right,root.val,max)
}
var isValidBST = function(root) {
return verifyBST(root,-2e32,2e32)
};
// @lc code=end