```
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
multiset<int> m;
vector<int> res;
for (int i=0; i<nums.size(); i++) {
if (target==nums[i]) m.insert(i);
}
if (!m.empty()) {
res.push_back(*m.begin());
res.push_back(*m.rbegin());
return res;
}
return {-1, -1};
}
};
```

// Not the best method but another idea, notice that *m.end() won't give you the last element but next to the last element.