解题思路:
class Solution {public boolean isValidBST(TreeNode root) {return recur(root,Long.MIN_VALUE,Long.MAX_VALUE);}public boolean recur(TreeNode root,long lower,long upper){if(root==null) return true;if(root.val<=lower||root.val>=upper) return false;return recur(root.left,lower,root.val)&&recur(root.right,root.val,upper);}
}