[Python] Solution with explanation,100% faster runtime,  100% less memory usage
\n\nclass BrowserHistory:\n\n    def __init__(self, homepage: str):\n        self.arr = [homepage]\n        self.frwd = 0  # number of urls which will be displa
\n```\nclass BrowserHistory:\n\n    def __init__(self, homepage: str):\n        self.arr = [homepage]\n        self.frwd = 0  # number of urls which will be displayed after passing forward\n        self.cur = 0 # current displayed url\'s index\n\n    def visit(self, url: str) -> None:\n        self.arr = self.arr[:self.cur+1] # previous history(urls which will be displayed after forward) will be deleted\n        self.arr.append(url)\n        self.frwd = 0  # there is no forward history and set to 0\n        self.cur += 1 # current index is increased\n        \n\n    def back(self, n: int) -> str:\n        if n <= self.cur: # switch to the page which is n steps back \n            self.cur -= n \n            self.frwd += n\n\t   else:   # switch to home page when n is greater than possible back steps\n            self.cur = 0 # current index is set to homepage\n            self.frwd = len(self.s)-1  # the number of remaining pages for which there is access to the switch\n        return self.arr[self.cur] # returns the current page\n\n    def forward(self, n: int) -> str:\n        if n <=self.frwd: # switch to the page which is n steps forward \n            self.frwd -= n \n            self.cur += n \n        else:    # switch to the last page when n is greater than possible forward steps\n            self.cur = len(self.s)-1 # current index is set to last page\'s index\n            self.frwd = 0 # there is no else forward page\n        return self.arr[self.cur] # returns the current page\n\n\n\n```
['Python', 'Python3']