-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday5.cpp
More file actions
28 lines (21 loc) · 661 Bytes
/
day5.cpp
File metadata and controls
28 lines (21 loc) · 661 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
#include<bits/stdc++.h>
using namespace std;
vector<int> findUnion(vector<int> &a, vector<int> &b) {
a.insert(a.end(), b.begin(), b.end());
set<int> final(a.begin(), a.end());
vector<int> val(final.begin(), final.end());
return val;
}
int main() {
vector<int> v = {1, 22, 3, 4, 5, 5, 5, 6};
vector<int> b = {1, 2, 44, 55, 9};
int k = 5;
// bool check = binary_search(v.begin(),v.end(),k);
// auto it = lower_bound(v.begin(),v.end(),k);
// cout<<it - v.begin()<<" The element is present at this index"<<endl;
vector<int> ki = findUnion(v, b);
for (auto i: ki) {
cout << i << " ";
}
return 0;
}