Capgemini interview question

Optimization