PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Chime

Implement single-tab browser history navigation

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of data structures, stateful API behavior, amortized time complexity, set membership tracking, and edge-case handling for implementing browser-like history navigation in the coding & algorithms domain.

  • Medium
  • Chime
  • Coding & Algorithms
  • Software Engineer

Implement single-tab browser history navigation

Company: Chime

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Implement a BrowserSession for a single-tab browser. APIs: - BrowserSession(string homepage): Initialize with homepage; current page starts at homepage. - void visit(string url): Navigate to url from the current page and clear any forward history. - string back(int steps): Move up to steps back in history; if fewer pages exist, move as far as possible. Return the current url after the move. - string forward(int steps): Move up to steps forward in history; if fewer pages exist, move as far as possible. Return the current url after the move. Bonus: - bool haveVisited(string url): Return whether the session has ever visited url at least once since construction, regardless of whether it is currently in back/forward history. Requirements: - Target O( 1) amortized time per operation and O(n) space for n total visits. - Define how to handle edge cases (e.g., steps <= 0, visiting the same url consecutively, empty forward history). - Describe and justify your data structure choices (e.g., two stacks, doubly linked list + cursor, dynamic array + index) and their trade-offs in time/space.

Quick Answer: This question evaluates understanding of data structures, stateful API behavior, amortized time complexity, set membership tracking, and edge-case handling for implementing browser-like history navigation in the coding & algorithms domain.

Related Interview Questions

  • Solve classic backend coding problems - Chime (medium)
  • Compute minimum time with task cooldowns - Chime (Medium)
  • Find missing number from concatenated digits - Chime (Medium)
  • Simulate toppling board game outcome - Chime (Medium)
Chime logo
Chime
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
7
0

Implement a BrowserSession for a single-tab browser.

APIs:

  • BrowserSession(string homepage): Initialize with homepage; current page starts at homepage.
  • void visit(string url): Navigate to url from the current page and clear any forward history.
  • string back(int steps): Move up to steps back in history; if fewer pages exist, move as far as possible. Return the current url after the move.
  • string forward(int steps): Move up to steps forward in history; if fewer pages exist, move as far as possible. Return the current url after the move.

Bonus:

  • bool haveVisited(string url): Return whether the session has ever visited url at least once since construction, regardless of whether it is currently in back/forward history.

Requirements:

  • Target O(
  1. amortized time per operation and O(n) space for n total visits.
  • Define how to handle edge cases (e.g., steps <= 0, visiting the same url consecutively, empty forward history).
  • Describe and justify your data structure choices (e.g., two stacks, doubly linked list + cursor, dynamic array + index) and their trade-offs in time/space.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Chime•More Software Engineer•Chime Software Engineer•Chime Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.