Amazon interview question

Math question