Google interview question

dsa question on greedy and graph