判断是不是二叉搜索树
递归判断
public boolean isValidBST (TreeNode root) {
// write code here
return dfs(root,Integer.MIN_VALUE,Integer.MAX_VALUE);
}
public boolean dfs(TreeNode root,int l,int r){
if(root==null) return true;
if(root.val<l||root.val>r) return false;
return dfs(root.left,l,root.val)&&dfs(root.right,root.val,r);
}