EPAM Systems interview question

Can you evaluate the algorithm's complexity?