#C10067. Second Largest Unique Number
Second Largest Unique Number
Second Largest Unique Number
You are given T test cases. For each test case, you are given a list of integers. Your task is to determine the second largest unique number in the list. If there are fewer than two distinct numbers, output None
.
More formally, let \( U \) be the set of unique numbers from the list. If \(|U| < 2\), then the answer is None
; otherwise, if the unique numbers sorted in descending order are \( u_1, u_2, \dots \), then the answer is \( u_2 \).
inputFormat
The input is read from standard input and has the following format:
T N1 a1 a2 ... aN1 N2 b1 b2 ... bN2 ... NT c1 c2 ... cNT
Here, the first line contains a single integer T denoting the number of test cases. For each test case, the first line contains an integer N representing the number of elements, followed by a line with N space-separated integers.
outputFormat
For each test case, output a single line containing the second largest unique number if it exists, or None
if it does not.
2
5
2 3 5 5 6
4
1 1 3 3
5
1
</p>