As usual, you should gather the information in only one traversal of the array.You can assume that the second biggest value actual exists (there is at least two distinct values in the array), and that all values in the array are greater than [!python] -100000000.[/!] [!java|scala]<code>Integer.MIN_VALUE</code> (which is the smallest representable integer existing in [!thelang]).[/!]
Como normalmente, deve obter informações em apenas uma passagem pela array. Pode assumir que o segundo maior valor "actual" existe (existe pelo menos dois valores distintos na array) e que todos os valores na array são maiores que [!python] -100000000.[/!] [!java|scala]<code>Integer.MIN_VALUE</code> (que é o menor inteiro representável que existe em [!thelang]).[/!]