Java ArrayList solution O(1)
Intuition\n Describe your first thoughts on how to solve this problem. \nThe only drawback of this solution is that the list occasionally needs to increase its 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe only drawback of this solution is that the list occasionally needs to increase its capacity.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass MinStack {\n\n    public List<int[]> stack;\n\n    public MinStack() {\n        stack = new ArrayList();\n    }\n    \n    public void push(int val) {\n        if (stack.size() == 0) {\n            stack.add(stack.size() , new int[]{val, val});\n            return;\n        }\n        int min = getMin();\n        stack.add(stack.size() , new int[]{val, Math.min(min, val)});\n    }\n    \n    public void pop() {\n        stack.remove(stack.size() - 1);\n    }\n    \n    public int top() {\n        return stack.get(stack.size() - 1)[0];\n    }\n    \n    public int getMin() {\n        return stack.get(stack.size() - 1)[1];\n    }\n}\n\n/**\n * Your MinStack object will be instantiated and called as such:\n * MinStack obj = new MinStack();\n * obj.push(val);\n * obj.pop();\n * int param_3 = obj.top();\n * int param_4 = obj.getMin();\n */\n```
['Array', 'Java']