Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void solver(vector <int> v1,vector <int> v2)
- {
- sort(v1.begin(),v1.end());
- sort(v2.begin(),v2.end());
- int cont1=0,cont2=0;
- int limit1=v1.size(), limit2=v2.size();
- while(cont2!=limit2 and cont1!=limit1)
- {
- if(v1[cont1]!=v2[cont2])
- {
- if(v1[cont1]<v2[cont2])
- cont1++;
- else
- cont2++;
- }
- else
- {
- printf("%d\n", v1[cont1++]);
- cont2++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement