Amazon interview question

general question regarding dynamic programming