Well, of course, this can be done easily with 2 vectors.
Code:
vector<int> A;
vector<int> B;
bool ok = true;
for(auto x: A){
for(auto y: B) {
if(x==y) {
ok = false;
break;
}
}
if(ok) {
B.push_back(x);
}
ok = true;
}
But, can this be without having 15 lines of code ? What's the simplest way you would do this ?
Keep in mind that we need to have the same order elements appeared in vector.