#include<bits/stdc++.h>
using namespace std;
int main() {
vector <int> v = {1, 2 , 3, 2 , 1};
cout << v[0] << " " << v[1] << " " << v[2] << " " << v[3] << " " << v[4] << endl;
sort(v.begin(), v.end());
cout << v[0] << " " << v[1] << " " << v[2] << " " << v[3] << " " << v[4] << endl;
unique(v.begin(), v.end());
cout << v[0] << " " << v[1] << " " << v[2] << " " << v[3] << " " << v[4] << endl;
}
Output is
1 2 3 2 1
1 1 2 2 3
1 2 3 2 3
I'm not understanding what is unique function and how it is working ??