while(!v1.empty() || !v2.empty())
{
int k=0;
if(v1[k] < v2[k])
v1.erase(v1.begin());
else
v2.erase(v2.begin());
cout<<v1[0];
}
this is my code
here i want to remove the elements till one of them is empty(vectors are sorted) ,
like if
v1 contains 2,3,5,8
v2 contains 3,4,7
then according to me it should give me 8 but its giving segmentation fault
1 Answer