470,644 Members | 1,180 Online

# Problem about unique integers given two arrays 1
Given two arrays (the first array and the second array) of the same size,
each consisting of n positive integers, I want to write a c++ program to determine how many unique integers the second array have. Here a unique integer means that it shows only once in the second array but does not show in the first array. For example, if the first array is [1, 5, 3, 6, 8] and the second array is [2, 4, 2, 5, 9] (with n=5), the second array
has two unique integers (4 and 9)
Nov 26 '20 #1
2 3837 dev7060
570 Expert 512MB
Given two arrays (the first array and the second array) of the same size,
each consisting of n positive integers, I want to write a c++ program to determine how many unique integers the second array have. Here a unique integer means that it shows only once in the second array but does not show in the first array. For example, if the first array is [1, 5, 3, 6, 8] and the second array is [2, 4, 2, 5, 9] (with n=5), the second array
has two unique integers (4 and 9)
Select an element from the second. Compare it with every element in the first. If there's no match, check for the repetition.
Nov 26 '20 #2
AjayGohil
83 64KB
Hello,

For this you have to find unique element in second array. for finding unique element refer following site:

https://www.geeksforgeeks.org/print-...integer-array/

For finding unique element in second array which are not present in first array refer following site:

https://www.geeksforgeeks.org/find-e...ay-not-second/

Thank you
Dec 2 '20 #3