LeetCode:给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution
{
public:
vector<int> nums;
public:
int searchInsert(vector<int> &nums, int target)
{
int n = nums.size();
.
原创
2021-10-12 16:32:29 ·
620 阅读 ·
0 评论