Amazon interview question

Focused on problem solving and efficient code