DataVisor Interview Question

dp problem, recursion, bfs/dfs problem