Google interview question

2 algorithm tasks (graph and dynamic)