Java HashMap.
\nclass BrowserHistory {\n\n    Map<Integer,String> map;\n    int current,max;\n    public BrowserHistory(String homepage) {\n        current=max=1;\n        ma
```\nclass BrowserHistory {\n\n    Map<Integer,String> map;\n    int current,max;\n    public BrowserHistory(String homepage) {\n        current=max=1;\n        map = new HashMap<>();\n        map.put(current,homepage);\n    }\n\n    public void visit(String url) {\n        current++;\n        map.put(current,url);\n        max= current;\n    }\n\n    public String back(int steps) {\n        current = Math.max(current -steps,1);\n        return map.get(current);\n    }\n\n    public String forward(int steps) {\n        current =Math.min(current +steps,max);\n        return map.get(current);\n    }\n}\n```
[]