C++ unordered_map 100% faster
\nclass BrowserHistory {\npublic:\n    int i, sz;\n    unordered_map<int, string> m;\n    BrowserHistory(string homepage) {\n        m[0] = homepage;\n        i
```\nclass BrowserHistory {\npublic:\n    int i, sz;\n    unordered_map<int, string> m;\n    BrowserHistory(string homepage) {\n        m[0] = homepage;\n        i = 0;\n        sz = 1;\n    }\n    \n    void visit(string url) {\n        i++;\n        m[i] = url;\n        sz = i + 1;\n    }\n    \n    string back(int steps) {\n        if (i - steps < 0) i = 0;\n        else i -= steps;\n        return m[i];\n    }\n    \n    string forward(int steps) {\n        if (i + steps < sz) i += steps; \n        else i = sz - 1;\n        return m[i];\n    }\n};\n```
[]