Domanda di colloquio di Microsoft

Optimization Question: optimize code I wrote in interview