Pergunta de entrevista da empresa Mobilewalla

How would I change my solution given I want to scale this to an extremely large input problem size