C++ Simple and Precise solution using Vector only!!!
# Pls upvote you like the solution:)\n# Intuition\nThis question simple states that you have to push and just return the url which is present at a certain posit
# ***# Pls upvote you like the solution:)***\n# Intuition\nThis question simple states that you have to push and just return the url which is present at a certain position (i).\n\n# Approach\n- **BrowserHistory(string homepage)** :- Push back the homepage in a vector.\n- **void visit(string url)** :- I decalred a vector v in which we will push the url (*you just need to erase all the elements from the vector which are present after the position where you are going to insert a new url*).\n- **string back(int steps)** :- You just need to go back a certain number of steps from where you are current position is(i) in the vector and return that element.\n**Edge Case:-** Just remember you should not go beyond your **1st element**. Therefore I have handled that test case using the if condition.\n- **string forward(int steps)** :- You just need to go forward a certain number of steps from where you are current position is(i) in the vector and return that element.\n**Edge Case:-** Just remember you should not go beyond your **Last element**. Therefore I have handled that test case using the if condition.\n\n# Code\n```\nclass BrowserHistory {\npublic:\n    vector<string> v;\n    int i=0;\n    BrowserHistory(string homepage) {\n        v.push_back(homepage);\n        i=v.size()-1;\n    }\n    \n    void visit(string url) {\n        v.erase(v.begin()+i+1,v.end());\n        v.push_back(url);\n        i=v.size()-1;\n    }\n    \n    string back(int steps) {\n        if(steps>i){\n            i=0;\n            return v[0];\n        } \n        i = i - steps;\n        return v[i];\n    }\n    \n    string forward(int steps) {\n        if(steps>((v.size()-1)-i)){\n            i=v.size()-1;\n            return v[i];\n        } \n        i = i + steps;\n        return v[i];\n    }\n};\n```
['Array', 'C++']