Domanda di colloquio di Amazon

Complexity of this algorithm. How to improve the complexity?

Risposte di colloquio

Anonimo

6 giu 2011

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

3

Anonimo

2 giu 2011

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

1

Anonimo

9 giu 2011

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