Amazon interview question

Math flow problem was altered as your briefed your solution.