Domanda di colloquio di EPAM Systems

Can you evaluate the algorithm's complexity?