Practice Design Browser History
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Design Browser History
Problem Statement
Implement BrowserHistory(homepage) for one browser tab. visit(url) opens url from the current page and discards all forward history. back(steps) moves backward by at most that many available history entries and returns the resulting URL. forward(steps) moves forward by at most that many available entries and returns the resulting URL. If the requested move exceeds the available history, stop at its end.
Source: Design Browser History on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
["BrowserHistory","visit","visit","visit","back","back","forward","visit","forward","back","back"] [["leetcode.com"],["google.com"],["facebook.com"],["youtube.com"],[1],[1],[1],["linkedin.com"],[2],[2],[7]]
[null,null,null,null,"facebook.com","google.com","facebook.com",null,"linkedin.com","google.com","leetcode.com"]
Constraints
Related LeetCode Problems
Practice more problems similar to Design Browser History.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.