Whenever you're ready, walk me through how you'd approach this.
Explain how you would optimize a slow-running algorithm. Your answer should cover how you identify the bottleneck, what changes you would consider, and how you would verify the improvement.