Google interview question

Medium LeetCode problems, array and graph