Easy C++ solution using Linked List with Comments
This is pretty stright forward question , we just need to use a doubly linked list and do as stated in the question.\n\n## Code\n\nclass BrowserHistory {\n// we
This is pretty stright forward question , we just need to use a doubly linked list and do as stated in the question.\n\n## Code\n```\nclass BrowserHistory {\n// we declare a doubly linked list and an iterator for the same\n    list<string> bro;\n    list<string> :: iterator it;\npublic:\n    BrowserHistory(string homepage) {\n\t//push the homepage in the list and \n\t// and set the iterator at the beginning of the lsit\n        bro.push_back(homepage);\n        it = bro.begin();\n    }\n    \n    void visit(string url) {\n\t\t// delete the part of list after the current iterator\n        auto del = it;\n        del++;\n        bro.erase(del,bro.end());\n\t\t\n\t\t//push the new url in the list\n\t\t//and point the iterator to this url\n        bro.push_back(url);\n        it++;\n    }\n    \n    string back(int steps) {\n\t// move the it backwards till either the steps = 0 \n\t// or we reach head of the lsit\n        while(it != bro.begin() and steps-- > 0)\n        {\n            it--;\n        }\n        \n\t\t// return value at ths it\n        return *it;\n    }\n    \n    string forward(int steps) {\n\t// move the it backwards till either the steps = 0 \n\t// or we reach last element of the lsit\n        while(it != --bro.end() and steps-- > 0)\n        {\n            it++;\n        }\n        \n\t\t// return value at ths it\n        return *it;\n    }\n};\n```
['Linked List', 'C']