public int searchInsert(int[] A, int target) {
        int sta = 0;
        int end = A.length;
        while (sta <= end){
            int mid = (sta + end)/2;
            if(A[mid] == target)
                return mid;
            else if(A[mid] < target)
                sta = mid +1;
            else
                end = mid-1;
        }
        return sta;
    }