Amazon interview question

dynamic programming, system design