#C10244. Second Smallest Unique Number
Second Smallest Unique Number
Second Smallest Unique Number
You are given a list of integers. Your task is to find the second smallest unique number in the list. If the list does not contain at least two unique numbers, output None
.
In mathematical terms, if the unique elements of the list are sorted in ascending order as $$a_1, a_2, \ldots, a_k$$ where $$k \ge 1$$, then you need to output $$a_2$$ if $$k \ge 2$$; otherwise, output None
.
Note: The input will be provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line of input contains an integer n
— the number of elements in the list. The second line contains n
space-separated integers representing the list.
Example:
5 3 1 5 2 4
outputFormat
Output a single line containing the second smallest unique integer in the list. If there is no such number, output None
.
Example:
2## sample
5
3 1 5 2 4
2