Amazon Interview Question

Debugging were trivial. Interview questions was medium / hard LC.