DoorDash interview question

About dp and the graph