示例 1:
输入:
[2, 3, 1, 0, 2, 5, 3]
输出:2 或 3
限制:2 <= n <= 100000
Set<Integer> set = new HashSet<>();
for (int num : nums) {
if (!set.add(num)){
return num;
}
}
示例 1:
输入:
[2, 3, 1, 0, 2, 5, 3]
输出:2 或 3
限制:2 <= n <= 100000
Set<Integer> set = new HashSet<>();
for (int num : nums) {
if (!set.add(num)){
return num;
}
}