Pergunta de entrevista da empresa EPAM Systems

Can you evaluate the algorithm's complexity?