Pergunta de entrevista da empresa Greek Ministry of Education

Question regarding the computational complexity of sample algorithm