Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers. It should be efficient way. means If you can then do it in O(n)

Try doing it on paper first. What numbers are missing from { 5 2 8 1 10 3 7 4 }? How did you work it out? OK, if you looked for 1, then 2, then 3 etc, that's inefficient. Work it out again starting at the first element in the array, looking at each element only once. Hint: You can take notes. For example, how might you keep track of the fact that you've seen a 5 after processing the first element?