Pergunta de entrevista da empresa Google

First ask some basic BQ, and two following leetcode questions. The first one is hard, the second is medium,. Total 45min. Will have two follow up question about how to improve time complexity