Amazon Interview Question

Part one was 2 programming questions.