Sollicitatievraag bij Amazon

Complexity of this algorithm. How to improve the complexity?

Antwoorden op sollicitatievragen

Anoniem

6 jun 2011

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

3

Anoniem

2 jun 2011

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

1

Anoniem

9 jun 2011

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