// Merge two sorted arrays
vector<int> merge(vector<int> vec1, vector<int> vec2){
int len1 = vec1.size();
int len2 = vec2.size();
vector<int> vec;
int i = 0, j=0;
while(i < len1 || j < len2){
if(i >= len1){
vec.push_back(vec2[j]);
j++;
}
else if(j >= len2){
vec.push_back(vec1[i]);
i++;
}
else{
if(vec1[i] < vec2[j]){
vec.push_back(vec1[i]);
i++;
}
else if(vec1[i] == vec2[j]){
vec.push_back(vec1[i]);
vec.push_back(vec2[j]);
i++; j++;
}else{
vec.push_back(vec2[j]);
j++;
}
}
}
return vec;
}