Hehe f up solution using map and sets


#1
vector<int> Solution::solve(vector<int> &A, vector<int> &B, vector<int> &C) {

map<int,int>mp1,mp2,mp3;

set<int>s;
vector<int>vec;

for(int i=0;i<A.size();i++)
mp1.insert({A[i],i});
for(int i=0;i<B.size();i++)
mp2.insert({B[i],i});
for(int i=0;i<C.size();i++)
mp3.insert({C[i],i});


for(int i=0;i<A.size();i++)
{
    if(mp2.find(A[i])!=mp2.end()  or mp3.find(A[i])!=mp3.end())
    {
        s.insert(A[i]);
    }
}

for(int i=0;i<B.size();i++)
{
    if(mp1.find(B[i])!=mp1.end()  or mp3.find(B[i])!=mp3.end())
    {
        s.insert(B[i]);
    }
}

for(int i=0;i<C.size();i++)
{
    if(mp2.find(C[i])!=mp2.end()  or mp1.find(C[i])!=mp1.end())
    {
        s.insert(C[i]);
    }
}

for(auto it : s)
vec.push_back(it);


return vec;

}