Pergunta de entrevista da empresa Qualtrics

What is the time and space complexity of your code