Design multi-tab browser history and trade-offs

Quick Overview

This question evaluates a candidate's competence in system design, data-structure selection, API specification, concurrency control, and eviction/semantic strategies for a multi-tab browser-history manager, testing skills in reasoning about per-tab state, operation complexity, and memory trade-offs.

Design multi-tab browser history and trade-offs

Company: Chime

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Extend the single-tab history to support multiple tabs. APIs to support (design the interface): - int openTab(string homepage): Create a new tab and return its identifier. - void closeTab(int tabId): Close the tab and free its history. - void switchTab(int tabId): Make tabId the active tab. - void visit(string url), string back(int steps), string forward(int steps): Apply to the active tab. - Optional: bool haveVisited(string url): Define per-tab and/or global semantics. Requirements and discussion: - Choose data structures to manage tabs and their histories (e.g., map from tabId to per-tab history, list/array to track tab order). Compare trade-offs (map vs list), memory footprint, and operation complexity. - Consider thread-safety if multiple tabs can act concurrently; outline locking or immutability strategies. - Discuss history capping/eviction policies and their effect on haveVisited semantics. - Specify complexity targets for each operation and justify your design decisions.

Overview: This question evaluates a candidate's competence in system design, data-structure selection, API specification, concurrency control, and eviction/semantic strategies for a multi-tab browser-history manager, testing skills in reasoning about per-tab state, operation complexity, and memory trade-offs.

|Home/System Design/Chime
Chime logo
Chime
Sep 6, 2025
mediumSoftware EngineerTechnical ScreenSystem Design
34
0

Design: Multi-Tab Browser History

Context: Extend a single-tab browser-history component into a multi-tab manager that supports opening/closing tabs, switching the active tab, and performing visit/back/forward on the active tab.

APIs to Design

  1. int openTab(string homepage)
  2. void closeTab(int tabId)
  3. void switchTab(int tabId)
  4. void visit(string url)
  5. string back(int steps)
  6. string forward(int steps)
  7. Optional: bool haveVisited(string url) — define per-tab and/or global semantics

Functional Requirements

  • Each tab maintains its own navigational history (back/current/forward).
  • visit(url) clears the forward history of the active tab and navigates to url.
  • back(steps) and forward(steps) move within the active tab, clamped by available steps, and return the current URL.
  • openTab returns a stable, unique tab identifier; switchTab changes which tab is considered active.
  • closeTab disposes of the tab’s history.

Design Discussion Requirements

  • Data structures for:
    • Per-tab history.
    • Registry of open tabs and (optionally) their order (e.g., MRU).
  • Compare trade-offs (e.g., map vs. list) including memory footprint and operation complexity.
  • Complexity targets and justification per operation.
  • Thread-safety if multiple tabs can act concurrently: propose locking/immutability.
  • History capping/eviction policies and how they affect haveVisited semantics (per-tab and/or global).

Assumptions (refine as needed)

  • Up to N tabs (e.g., 1e5). Each tab’s history can be capped at H entries.
  • Active tab is maintained per Browser instance/session.
  • URLs are arbitrary strings.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...