Google Interview Question

DSA with graphs and dp