Java Node with two pointers (aka doubly LinkedList) faster than 97%
\nclass BrowserHistory {\n    \n    class Node {\n        Node forward;\n        Node backward; \n        String page; \n        \n        public Node(String pa
```\nclass BrowserHistory {\n    \n    class Node {\n        Node forward;\n        Node backward; \n        String page; \n        \n        public Node(String page, Node backward) {\n            this.page = page;\n            this.backward = backward;\n            forward = null;\n        }\n    }\n    \n    Node cur;\n\n    public BrowserHistory(String homepage) {\n        cur = new Node(homepage, null); \n    }\n    \n    public void visit(String url) {\n\t\tif (cur.forward != null)\n\t\t\tcur.forward.backward = null; \n        cur = (cur.forward = new Node(url, cur));\n    }\n    \n    public String back(int steps) {\n        while (steps-- > 0 && cur.backward != null)\n            cur = cur.backward;\n        return cur.page;\n    }\n    \n    public String forward(int steps) {\n        while (steps-- > 0 && cur.forward != null)\n            cur = cur.forward;\n        return cur.page;\n    }\n}\n```
['Java']