Amazon Interview Question

Typical programming problems.