Amazon Interview Question

Usual algorithm and debugging questions.