Amazon interview question

2 coding questions, 1 easy 1 hard