Simple Solution || Using Vector C++
\n# Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(n)\n# Code\n\nclass BrowserHistory {\n\n    vector<string> list;\n    int currIndex;\n\npublic:
\n# Complexity\n- Time complexity:\n$$O(n)$$\n- Space complexity:\n$$O(n)$$\n# Code\n```\nclass BrowserHistory {\n\n    vector<string> list;\n    int currIndex;\n\npublic:\n\n    BrowserHistory(string homepage) {\n        list.push_back(homepage);\n        currIndex = 0;\n    }\n    \n    void visit(string url) {\n        // removing all the forward history until currIndex\n        while(currIndex < list.size()-1)\n        {\n            list.pop_back();\n        }\n        list.push_back(url);\n        currIndex++;\n    }\n    \n    string back(int steps) {\n        int newInd = currIndex - steps;\n        if(newInd < 0) newInd = 0;\n        currIndex = newInd;\n        return list[currIndex];\n    }\n    \n    string forward(int steps) {\n        int newInd = currIndex + steps;\n        if(newInd > list.size()-1) newInd = list.size()-1;\n        currIndex = newInd;\n        return list[currIndex];\n    }\n};\n\n/**\n * Your BrowserHistory object will be instantiated and called as such:\n * BrowserHistory* obj = new BrowserHistory(homepage);\n * obj->visit(url);\n * string param_2 = obj->back(steps);\n * string param_3 = obj->forward(steps);\n */\n```
['C++']