Simple Classsic hashing


#1

vector Solution::solve(vector &A, vector &B, vector &C) {
int h1[1000001]={0},h2[1000001]={0},h3[1000001]={0};
for(auto it: A)h1[it]++;
for(auto it: B)h2[it]++;
for(auto it: C)h3[it]++;
vectorans;
for(int i=1; i<=1000000; i++){
if( (h1[i] >0 && h2[i]>0) || (h2[i] >0 && h3[i]>0) || (h3[i] >0 && h1[i]>0) )ans.push_back(i);
}
return ans;
}