public boolean cal(int[] A, int target, int l, int r) {
        if (l > r) return false;
        int mid = (l + r) / 2;
        if (target == A[mid]) return true;

        //reach duplicate point
        if (A[l] == A[mid] && A[r] == A[mid])
            return cal(A, target, l + 1, mid - 1) || cal(A, target, mid + 1, r - 1);

        if (A[mid] >= A[l]) {
            if (target < A[mid] && target >= A[l])
                return cal(A, target, l, mid - 1);
            else
                return cal(A, target, mid + 1, r);
        } else {
            if (target > A[mid] & target <= A[r])
                return cal(A, target, mid + 1, r);
            else
                return cal(A, target, l, mid - 1);
        }
    }