filmov
tv
Intersection Of Sorted Arrays 2019 12 22 at 13 39 26

Показать описание
Union and Intersection of two sorted arrays
Given two sorted arrays, find their union and intersection.
Example:
* Input :
arr1[] = {1, 3, 4, 5, 7}
arr2[] = {2, 3, 5, 6}
* Output :
Union : {1, 2, 3, 4, 5, 6, 7}
Intersection : {3, 5}
* Input :
arr1[] = {2, 5, 6}
arr2[] = {4, 6, 8, 10}
* Output :
Union : {2, 4, 5, 6, 8, 10}
Intersection : {6}
Given two sorted arrays, find their union and intersection.
Example:
* Input :
arr1[] = {1, 3, 4, 5, 7}
arr2[] = {2, 3, 5, 6}
* Output :
Union : {1, 2, 3, 4, 5, 6, 7}
Intersection : {3, 5}
* Input :
arr1[] = {2, 5, 6}
arr2[] = {4, 6, 8, 10}
* Output :
Union : {2, 4, 5, 6, 8, 10}
Intersection : {6}