```
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
vector<int> result(2,-1);
bool isFirst=true;
for(int i = 0; i < nums.size(); i++)
{
if(nums[i]==target && isFirst==true)
{
result[0]=i;
result[1]=i;
isFirst=false;
continue;
}
if(nums[i]==target && isFirst==false)
{
result[1]++;
continue;
}
if(nums[i]>target)
break;
}
return result;
}
};
```