Amazon Interview Question

Designing algorithm with the best possible time-complexity?