Single map simple code


#1

Comment body goes hvector Solution::solve(vector &A, vector &B, vector &C) {
map <int,int> m1; vector v;

int n1=A.size(),n2=B.size(),n3=C.size();

for(int i=0;i<n1;i++)
    if(m1[A[i]]==0)
    m1[A[i]]=1;
    
    for(int i=0;i<n2;i++)
    if(m1[B[i]]==1)
    m1[B[i]]=2;
    
    for(int i=0;i<n2;i++)
    if(m1[B[i]]==0)
    m1[B[i]]=1;
    
    for(int i=0;i<n3;i++)
    if(m1[C[i]]==1)
    m1[C[i]]=2;



for(auto f:m1)
if(f.second==2)
v.push_back(f.first);

return v;

}
ere.