```
int searchInsert(int A[], int n, int target) { //binary search
int iLow = 0;
int iHigh = n-1;
while (iLow < iHigh) {
// Take the average as the test value
int iCheck = ((iLow + iHigh) >> 1);
if (A[iCheck] > target) {
iHigh = iCheck;
} else {
iLow = iCheck;
}
}
return (A[iLow] < target)?iLow+1:iLow;
}
```

while this piece with a minor change with the iHigh variable is accepted.

```
int searchInsert(int A[], int n, int target) { //binary search
int iLow = 0;
int iHigh = n;
while (iLow < iHigh - 1) {
// Take the average as the test value
int iCheck = ((iLow + iHigh) >> 1);
if (A[iCheck] > target) {
iHigh = iCheck;
} else {
iLow = iCheck;
}
}
return (A[iLow] < target)?iLow+1:iLow;
}
```