Azienda coinvolta
Given an array, return the nth largest.
Anonimo
No sorting...it would take nlgn for sorting and it could be faster..
http://en.wikipedia.org/wiki/Selection_algorithm
Can be in any language. I did write the working code, but the interviewer pointed out that it won't work for some special cases.
public static void sortArray(int n){ Integer[] arrayList = {12,2,5,1,7,8,3,4,9,10,13,11,6}; Arrays.sort(arrayList); System.out.println("for number : " + (n + 1) + " we get: " + arrayList[n]); }
Non lasciarti sfuggire opportunità e informazioni privilegiate seguendo le aziende dove vorresti lavorare.
Ricevi suggerimenti e aggiornamenti personalizzati avviando le tue ricerche.