Occurence of Each Number: Simple Solution in C++

vector Solution::findOccurences(vector &A) {

map<int,int>mp;

vector<int>v;

for(int i=0;i<A.size();i++)

{

    mp[A[i]]++;

}

for(auto i:mp)

{

    v.push_back(i.second);

}

return v;

}

Click here to start solving coding interview questions