Pergunta de entrevista da empresa Apify

How would you improve time complexity of a given code?