Amazon interview question

Dynamic Programming and Graphs and Vertices