✅💯🔥Simple Code🚀📌|| 🔥✔️Easy to understand🎯 || 🎓🧠Beats 100%🔥|| Beginner friendly💀💯
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 MinStack {\n    public Stack<Integer> stac;\n    public Stack<Integer> minStac;\n\n    public MinStack() {\n        stac = new Stack<>();\n        minStac = new Stack<>();\n    }\n    \n    public void push(int val) {\n        stac.push(val);\n        if (minStac.isEmpty() || val<=minStac.peek()) {\n            minStac.push(val);\n        }\n    }\n    \n    public void pop() {\n        int a = minStac.peek();\n        if (stac.pop()==a) {\n            minStac.pop();\n        }\n    }\n    \n    public int top() {\n        return stac.peek();\n    }\n    \n    public int getMin() {\n        return minStac.peek();\n    }\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```\n![7be995b4-0cf4-4fa3-b48b-8086738ea4ba_1699897744.9062278.jpeg](https://assets.leetcode.com/users/images/fe5117c9-43b1-4ec8-8979-20c4c7f78d98_1721303757.4674635.jpeg)
['Stack', 'Design', 'C', 'Python', 'C++', 'Java']