Amazon Interview Question

A few coding problems, moderate difficulty.