Amazon Interview Question

Nothing so difficult actually.