class Solution {
public:
int searchInsert(int A[], int n, int target) {
int j=lower_bound(A,A+n,target)-A;
if(j>=n)return n;
if(A[j]==target)return j;
else return j;
}
};
class Solution {
public:
int searchInsert(int A[], int n, int target) {
int j=lower_bound(A,A+n,target)-A;
if(j>=n)return n;
if(A[j]==target)return j;
else return j;
}
};
本文标题:search-insert-position
本文链接:https://www.haomeiwen.com/subject/derkcctx.html
网友评论