Uber Interview Question

Coding question related to DP and graphs