Pergunta de entrevista da empresa Amazon

write a function to find 2nd highest value in an array. Basic questions on STL library , some baisc regrex questions , difference between left join right join ( only basic stuff). I guess w3school tutorial is fine incase if you want to refresh . simple sql query using joins.

Respostas da entrevista

Sigiloso

28 de out. de 2011

For sql , w3schools tutorial is enough to brush up the things

Sigiloso

16 de jan. de 2013

Second highest number in an array public class SecondHighest { public static int secondhighest(int[] arr){ if (arr == null){ return -1; } if (arr.length ==1){ return -1; } int max = arr[0] > arr[1] ? arr[0] : arr[1]; int max2 = arr[0] max){ max2 = max; max = arr[i]; } else if (arr[i] > max2){ max2 = arr[i]; } } return max2; } public static void main (String[] args){ int[] arr = {1,-2,4,7,-9,45,34,-92}; System.out.println(secondhighest(arr)); } }