Map with vector easy sol


#1

Comment body goes here.vector Solution::solve(vector &A, vector &B, vector &C) {
map<int,vector>m;
for(int i=0;i<A.size();i++)
{
if(m.find(A[i])==m.end())
{
m[A[i]]={1,0,0};
}
}
for(int i=0;i<B.size();i++)
{
if(m.find(B[i])==m.end())
{
m[B[i]]={0,1,0};
}
else
{
m[B[i]][1]=1;
}
}
for(int i=0;i<C.size();i++)
{
if(m.find(C[i])==m.end())
{
m[C[i]]={0,0,1};
}
else
{
m[C[i]][2]=1;
}
}
vectorv;
for(auto i=m.begin();i!=m.end();i++)
{
if((i->second[0])+(i->second[1])+(i->second[2])>=2)
{
v.push_back(i->first);
}
}
return v;

}