Given you have an array A[1..n] of size n, it contains elements from the set {1..n}. However, two of the elements are missing, (and perhaps two of the array elements are rep
As we know we are looking for elements between 1 to N Create a Hash set containing 1 to N.
foreach(int i in input) { if(hashset.contains(i)) { hashset.delete(i); } } return "remaining elements in Hashset.";
The remaining elements in Hashset are the missing elements.