Implement a method to find the second largest number in an array of ints.
If the input array is empty or contains only a single number, the method must return Integer.MIN_VALUE
.
If the input array contains multiple largest elements, consider them as the same value.
Sample Input:
1 5 3 1 2 4 6
Sample Output:
5
Sample Input:
17 17 -10 -10 -15
Sample Output:
-10
Sample Input:
15 15
Sample Output:
-2147483648
Memory limit: 256 MB
Time limit: 2 seconds
Show topic summary