Design Browser History (#1472)
You have a browser of your own. You start on the homepage, and you can visit a new URL, move back and forward in history.
Implement the BrowserHistory class:
BrowserHistory(string homepage)Initializes the object with thehomepageof the browser.void visit(string url)Visitsurlfrom the current page. It clears up all the forward history.string back(int steps)Movestepsback in history. If you can only returnxsteps in the history andsteps > x, you will return onlyxsteps. Return the current URL after moving back in history at moststeps.string forward(int steps)Movestepsforward in history. If you can only forwardxsteps in the history andsteps > x, you will forward onlyxsteps. Return the current URL after forwarding in history at moststeps.
Company Tags: Amazon
Core Concept: Array, Linked List, Stack