Pregunta de entrevista de Google Cloud

Graph question with dynamic programming