JAVA || Easy Solution || ArrayList || Easy to Understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass BrowserHistory {\n\nList<String> list;\nint total = 0;\nint curr = 0;\n\npublic BrowserHistory(String homepage) {\n\tlist = new ArrayList<String>();\n\tlist.add(homepage);\n\ttotal++;\n      curr++;\n}\n\npublic void visit(String url) {\n\tif (list.size() > curr) {\n\t\tlist.set(curr, url);\n\t} else {\n\t\tlist.add(url);\n\t}\n\tcurr++;\n\ttotal = curr;\n}\n\npublic String back(int steps) {\n\tcurr = Math.max(1, curr - steps);\n\treturn list.get(curr - 1);\n}\n\npublic String forward(int steps) {\n\tcurr = Math.min(total, curr + steps);\n\treturn list.get(curr - 1);\n}\n}\n```
['Java']