Amazon interview question

puzzle-based logical reasoning