点击打开链接
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<limits.h>
#include<assert.h>
#define LL long long
#define inf 0x3f3f3f3f
#define mod 1e9+7
using namespace std;
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
vector<int> res;
int len=upper_bound(nums.begin(),nums.end(),target)-lower_bound(nums.begin(),nums.end(),target);
int fir=lower_bound(nums.begin(),nums.end(),target)-nums.begin();
if(len==1){
res.push_back(fir);
res.push_back(fir);
return res;