Robert Bosch interview question

How to optimize a solution