Find Missing and Duplicate Number In An Array
Given an unsorted array of size n. Array elements are in range from 1 to n. One number from set {1, 2, …n} is missing and one number occurs twice in array. We must write a program to find the missing and duplicate numbers. For eg:
Int a[] = {1,2,3,4,6,7,8,9,10,4};
As you can see in above example, missing number is “5” and duplicate number is “4”.
(more…)