Google interview question

Focused on graph and dp mainly