Simple C++ Solution using two vectors

vector Solution::searchRange(const vector &A, int B) {
vector a, b;
for (int i=0;i<A.size();i++)
{
if(A[i]==B)
{
a.push_back(i);
}
}
if (a.size()!=0)
{
b.push_back(a[0]),b.push_back(a[a.size()-1]);
}
else
{
b.push_back(-1),b.push_back(-1);
}
return b;
}

don’t u know the tag of this solution
what is ur time complexity??

Click here to start solving coding interview questions