Question d’entretien chez Amazon

Graph question with DP problem