Pregunta de entrevista de Cashgro

How can we optimise the assignment better.