Google interview question

One leetcode hard and one medium