[C++] Easy to understand with explanation and a bit of advice
Pls upvote if you find this helpful  :)\nFirst of all if you are attempting this problem so let me tell you these kind of problems teach you a lot and have vast
***Pls upvote if you find this helpful  :)***\nFirst of all if you are attempting this problem so let me tell you these kind of problems teach you a lot and have vast application in the industry.Try to have the essence of this question.Give your time to it if you haven\'t and then come back again.\nIf you are still reading this i assume you have given your shot to this question.\nComing to the solution,it asks you to create browser history.First of all create an array **browser**\nand an integer **pos**to keep track of position.\n**BrowserHistory**-Just push the homepage to the browser array.\n**Visit**-There are two parts of this function.If you are at any position between (0 -  browser.size()-2) then increase the position and resize the array holding only elements upto the current position else if you were at the end then just add that element to the array.\n**Back**-You need to move back the given number of steps from your current position and return the corresponding element.The catch was you cannot move behind 0.Hence if your pos changes to less than 0.You make it 0 and return browser[0].\n**Forward**-Just like back ,here you cannot exceed the last element and return the last element if your pos exceeds it.\n\n```\nclass BrowserHistory {\npublic:\n    vector<string>browser;\n    int pos=0;\n    BrowserHistory(string homepage) {\n        browser.push_back(homepage);\n    }\n    \n    void visit(string url) {\n        pos++;\n        if(pos<=browser.size()-1){\n            browser[pos]=url;\n            browser.resize(pos+1);\n        }\n        else browser.push_back(url);       \n    }\n    string back(int steps) {\n      pos-=steps;\n        if(pos<0)pos=0;\n        return browser[pos];\n    }\n    \n    string forward(int steps) {\n       pos+=steps;\n        if(pos>browser.size()-1)pos=browser.size()-1;\n        return browser[pos];\n    }\n};\n```\nAdvice-Keep giving the contests and the changes do come .I started from doing 1 question that too in about 1:15 hours and today(7th June 2020) i completed 3 questions including this one.Just can\'t wait to complete all 4 in the upcoming contests.Pls keep up the motivation and happy coding  :)
['C', 'C++']