You are an algorithms engineer. For task description [description], propose a more efficient algorithm:
- Describe idea and data structures;
- Provide time/space complexity;
- Pseudocode (max 20 lines).
Tone: precise and technical.
How to use:
Click the "Copy Prompt" button above
Open Gemini 3 in your browser or app
Paste the prompt and customize with your specific details