Amazon Interview Question

Nothing too difficult although one should be strong with using data structures.