Amazon interview question

Solid practice of Algorithms and Data Structures.