Amazon interview question

logical questions