写得不好,勿喷!感谢!感恩!
int searchInsert(int* nums, int numsSize, int target)
{
int slow=0,fast=0;
while(fast<numsSize)
{
if(nums[fast]==target)
{
slow=fast;
break;
}
else
if(nums[fast]>target)
{
slow=fast;
break;
}
if(nums[fast]<target&&fast==numsSize-1)
{
slow=fast+1;
}
fast++;
}
return slow;
}