Amazon interview question

Expect easy and medium code challenges.