Your question is Optimizing Existing Algorithms for Performance. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
At companies like Stripe or Netflix, interviewers often ask how you would improve a working but slow algorithm. They want to see structured reasoning, not just a faster final answer.
Explain how you would optimize an existing algorithm to improve performance. In your answer, address:
Focus on a practical engineering approach: start from baseline complexity, profile or reason about hot spots, propose targeted improvements, and discuss trade-offs. You do not need to cover low-level compiler or hardware tuning unless it directly affects the algorithmic design.