Google interview question

graph question and dynamic programing question