Amazon Interview Question

Solve two different coding questions.