Frage im Vorstellungsgespräch bei Goldman Sachs

Find the second smallest element in an array.

Antworten zu Vorstellungsgespräch

Anonym

31. Juli 2018

Went with two variables which mainted the current least two elements and then returned the second lease. Took care of edge cases like <2 elements.

1

Anonym

29. Sept. 2019

Arrays.sort(arr); arr[length-1] would do this

1