Google interview question

Mid or Hard leetcode problem solving