Amazon interview question

Solving algo problems