Missing Number
Tag(s):

Easy, Quicksort, Sorting

Problem
Editorial
Analytics

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}$

SAMPLE INPUT
2
6
1 3 3 3 6 7
3
3 0 2
SAMPLE OUTPUT
8
4
Explanation

In the first sample test case, for 0 based indexing, if we decrement the $A_1$ to 2, $A_4$ to 4 and $A_5$ to 6. the array becomes $[1,2,3,3,4,6]$. The smallest positive multiple of 2 which is not in the modified array is 8, thus the missing number is 8.
In the second sample test case, with or without decrements we can get 2 as the only multiple of 2 in the array, thus the missing number is 4.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...

Contributor 