[Python3] Browser History: Constant Time Operations
\nclass BrowserHistory:\n\n    def __init__(self, homepage: str):\n        self.history_stack = []\n        self.current_url_index = -1\n        self.visit(home
```\nclass BrowserHistory:\n\n    def __init__(self, homepage: str):\n        self.history_stack = []\n        self.current_url_index = -1\n        self.visit(homepage)\n\n    def visit(self, url: str) -> None:\n        self.history_stack = self.history_stack[:self.current_url_index + 1]\n        self.history_stack.append(url)\n        self.current_url_index += 1\n\n    def back(self, steps: int) -> str:\n        if self.current_url_index - steps >= 0:\n            self.current_url_index -= steps\n        else:\n            self.current_url_index = 0\n\n        return self.history_stack[self.current_url_index]\n\n    def forward(self, steps: int) -> str:\n        if self.current_url_index + steps < len(self.history_stack):\n            self.current_url_index = self.current_url_index + steps \n        else:\n            self.current_url_index = len(self.history_stack) - 1\n        \n        return self.history_stack[self.current_url_index]\n\n```
['Python3']