Java - Faster than 100%. O(1) for ALL operations.
\n// Time complexity = O(1) for all operations\n// Space complexity = O(n), where n is the amount of times visit is called (this fairly inaccurate, but should s
```\n// Time complexity = O(1) for all operations\n// Space complexity = O(n), where n is the amount of times visit is called (this fairly inaccurate, but should suffice as a loose upperbound. the actual space complexity depends on the amount of visit() and back() called, as data is overwritten.\n\nclass BrowserHistory {\n    int currIndex, endIndex;\n    List<String> history;\n    \n    public BrowserHistory(String homepage) {\n        currIndex = 0; \n        endIndex = 0;\n        history = new ArrayList<>();\n        visit(homepage);\n    }\n    \n    public void visit(String url) {\n        history.add(currIndex++, url);\n        endIndex = currIndex;\n    }\n    \n    public String back(int steps) {\n        currIndex = Math.max(1, currIndex - steps);\n\t    return history.get(currIndex - 1);\n    }\n    \n    public String forward(int steps) {\n        currIndex = Math.min(endIndex, currIndex + steps);\n\t    return history.get(currIndex - 1);\n    }\n}\n```
['Java']