public boolean visit(TreeNode node, int low, int high){
        if(low != -1 && node.val <= low) return false;
        if(high != -1 && node.val >= high) return false;
        boolean res = true;
        if(node.left != null){
            if(!visit(node.left, low, node.val)) res = false;
        }
        if(node.right != null){
            if(!visit(node.right, node.val, high)) res = false;
        }
        return res;
    }