-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReverse_Int_STL.cpp
More file actions
50 lines (36 loc) · 810 Bytes
/
Reverse_Int_STL.cpp
File metadata and controls
50 lines (36 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
void merge(vector<int> &list1){
for(int i=0;i<list1.size();++i){
for(int j=i+1;j<list1.size();++j){
if(list1[i]==list1[j]){
vector<int>::iterator it = list1.begin()+j;
list1.erase(it);
}
}
}
for(int i=0;i<list1.size();++i){
for(int j=i+1;j<list1.size();++j){
if(list1[i]==list1[j]){
vector<int>::iterator it = list1.begin()+j;
list1.erase(it);
}
}
}
vector<int> v = list1;
for(int x=0;x<v.size();++x){
cout<<v[x]<<" ";
}
}
int main(){
vector<int> list1;
int l1;
cin>>l1;
for(int i=0;i<l1;++i){
int x;
cin>>x;
list1.push_back(x);
}
merge(list1);
}