Pergunta de entrevista da empresa Google

Medium leetcode question and its complexity analysis.