Amazon interview question

Mostly logic questions