Amazon interview question

Part one was 2 programming questions.