Google interview question

Asked me leetcode questions. (diffcult)