Amazon Interview Question

Nothing to difficult.