Amazon interview question

Math flow problem..