Meta interview question

Basic graph problem, dp problem