Chime·Software Engineer·Onsite - System Design / Architecture
- Design a multi-tab browser history system. You need to define the API (openTab, closeTab, switchTab, visit, back, forward, and optionally haveVisited) and choose appropriate data structures to back it.
- How would you manage the collection of tabs themselves? Walk through the tradeoffs between using a map versus a list, and how that affects memory and operation complexity.
- If multiple tabs can operate concurrently, how do you handle thread safety? What locking or immutability strategies would you consider?
- How would history capping or eviction policies affect the behavior of haveVisited, especially if you're tracking visited URLs across tabs?
“I started with the per-tab history piece since that felt familiar, basically a doubly-linked list or two stacks approach.”