# 思路
直接調用 lower_bound 找到位置,再減去 nums.begin() 得到位置的整數
# 參考程式碼
static auto fast_io = []  | |
{ | |
ios::sync_with_stdio(false);  | |
cout.tie(nullptr);  | |
cin.tie(nullptr);  | |
return 0;  | |
}();  | |
class Solution {  | |
public:  | |
int searchInsert(vector<int>& nums, int target)  | |
    {         | |
return lower_bound(nums.begin(), nums.end(), target) - nums.begin();  | |
    } | |
};  |