Amazon Interview Question

Algorithms for specific problems given