Find Two Missing Numbers Problem Statement
Given an array of unique integers where each element is in the range [1, N], and the size of the array is (N - 2), there are two numbers missing from this array. Your task is to identify and return these two missing numbers.
Example:
Input:
N = 6, arr = [1, 3, 6, 5]
Output:
2 4
Input Format:
The first line of input contains an integerT
, representing the number of test cases.
The first line of each test case contains an integerN
, whereN - 2
is the number of elements of the array.
The second line of each test case containsN - 2
space-separated integers, representing the array elements.
Output Format:
For each test case, print the two missing numbers from the range in increasing order.
The result for each test case should be printed in a separate line.
Constraints:
1 <= T <= 5
1 < N <= 5000
1 <= ARR[i] <= N
- Time Limit: 1 second
Note:
You do not need to print anything. The function is implemented, and output has been taken care of.
Be the first one to answer
Add answer anonymously...
Top Paxcom India Software Developer interview questions & answers
Popular interview questions of Software Developer
>
Paxcom India Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app