Google Interview Question

Focused on graph and dp mainly