#C2191. Find Missing Numbers in an Array
Find Missing Numbers in an Array
Find Missing Numbers in an Array
You are given an integer \(n\) and an array of \(n\) integers. The task is to find all the integers in the inclusive range \([1, n]\) that do not appear in the array. If every number in the range appears at least once in the array, output None
.
For example, if \(n = 8\) and the array is [7, 3, 1, 2, 8, 3, 4, 8], then the missing numbers are 5 and 6.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases.
For each test case:
- The first line contains an integer \(n\), which also defines the range \([1, n]\).
- The second line contains \(n\) space-separated integers representing the array elements.
outputFormat
For each test case, print a single line containing the missing numbers in increasing order, separated by a space. If there are no missing numbers, print None
.
2
8
7 3 1 2 8 3 4 8
5
1 2 3 4 5
5 6
None
</p>