Amazon interview question

Introduction