int searchInsert(int* nums, int numsSize, int target) {

```
int mid;
int l = 0;
int r = numsSize - 1;
while(l <= r) {
mid = (l+r)/2;
if(nums[mid] == target) {
return mid;
}
if(target < nums[mid]) {
r = mid - 1;
} else {
l = mid + 1;
};
}
return l;
```

}