问题1550-- Mex Query

1550: Mex Query

时间限制: 1 Sec  内存限制: 256 MB
提交: 1022  解决: 215
[状态] [讨论版] [提交] [命题人:]
题目描述
Give n non‑negative integers, please find the least non‑negative integer that doesn’t occur in the n numbers.
输入
The first line is an integer T, representing the number of test cases. 
For each test case: 
The first line of each test case is an integer n
The second line of each test case are n non‑negative integers ai.
(T ≤ 10,  n ≤ 2 × 105,  0 ≤ ai < 231)
输出
for each test case, output a line with the answer
样例输入 Copy
2
4
4 0 1 3
2
1 1
样例输出 Copy
2
0
来源/分类