Given an array of integers of size n which contains numbers from 0 to n - 2. Each number is present at least once. That is, if n
Answers
Answered by
0
Step-by-step explanation:
You are given an array of n+2 elements. All elements of the array are in range 1 to n. And all elements occur once except two numbers which occur twice. Find the two repeating numbers.
For example, array = {4, 2, 4, 5, 2, 3, 1} and n = 5
The above array has n + 2 = 7 elements with all elements occurring once except 2 and 4 which occur twice. So the output should be 4 2.
Similar questions