Apify interview question

How to scale this algorithmic task solution?