Frage im Vorstellungsgespräch bei Amazon

Find the maximum integer in an array of integers. Array could be really large.

Antwort im Vorstellungsgespräch

Anonym

7. Sep. 2014

Well it depends, if it is unsorted you will do a linear search, making it O(n). If it is sorted, just get the last element of the array, it will be the maximum.