Java solution using hashmap - O(1) operation
\nclass BrowserHistory {\n\n    int max = 0;\n    int current = 0;\n    HashMap<Integer, String> urlMap = new HashMap<>();\n    public BrowserHistory(String hom
```\nclass BrowserHistory {\n\n    int max = 0;\n    int current = 0;\n    HashMap<Integer, String> urlMap = new HashMap<>();\n    public BrowserHistory(String homepage) {\n        urlMap.put(current, homepage);\n    }\n    \n    public void visit(String url) {\n        current++;\n        urlMap.put(current, url);\n        max = current;\n    }\n    \n    public String back(int steps) {\n        current = Math.max(0, current-steps);\n        return urlMap.get(current);\n    }\n    \n    public String forward(int steps) {\n        current = Math.min(max, current+steps);\n        return urlMap.get(current);\n    }\n}\n```
['Java']