Google Cloud interview question

Graph question with dynamic programming