Robert Bosch Interview Question

How to optimize a solution