Question d’entretien chez Amazon

Complexity of this algorithm. How to improve the complexity?

Réponses aux questions d'entretien

Utilisateur anonyme

6 juin 2011

or could be linear time if you're allowed to use a hash table

3

Utilisateur anonyme

2 juin 2011

N^2 and can be improved to n logn using binary serach.

1

Utilisateur anonyme

9 juin 2011

I'm pretty sure hash table is the answer they were looking for...