Meta interview question

graph dp is main focus