Amazon Interview Question

Solve an algorithm problem