Pergunta de entrevista da empresa Google

Time and space complexity of implementation