Amazon interview question

Rod cutting do problem .