467,166 Members | 1,073 Online

# Problem about unique integers given two arrays

 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
• viewed: 3592
Share:
2 Replies
 Expert 256MB 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
 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