Missing Number
Practice
3 (15 votes)
Easy
Quick sort
Sorting
Problem
87% Success 7534 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given an array A. You can decrement any element of the array by 1. This operation can be repeated any number of times. A number is said to be missing if it is the smallest positive number which is a multiple of 2 that is not present in the array A. You have to find the maximum missing number after all possible decrements of the elements.

Input Format:
The first line of input contains T denoting number if test cases.
The first line of each test case contains N, the size of the array.
The second line of each test case contains N space seperated intergers.

Output Format:
Print the answer for each test case in a new line.

Constraints:

\(1 \le T \le 10 \)

\(1 \le N \le 10^{5} \)

\(0 \le A_{i} \le 10^{9} \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
17 votes
Tags:
AlgorithmsQuick SortSorting
Points:20
191 votes
Tags:
ApprovedEasyReadySorting
Points:20
10 votes
Tags:
AlgorithmsEasyQuick SortSorting