Simple C# Solution (With Explanation)
Approach 1\n\nThe provided code implements a MinStack class that supports push, pop, top, and retrieving the minimum element in constant time. It uses a stack t
# Approach 1\n\nThe provided code implements a `MinStack` class that supports push, pop, top, and retrieving the minimum element in constant time. It uses a stack to keep track of the elements along with their corresponding minimum values.\n\n# Steps:\n\n1. Initialize a stack to store tuples of values and their corresponding minimum values.\n2. Initialize `minVal` to `int.MaxValue` as there is no minimum value initially.\n3. Push new elements onto the stack along with the current minimum value.\n4. When popping an element, update `minVal` by looking at the minimum value of the new top element.\n5. The `Top` method returns the value of the top element in the stack.\n6. The `GetMin` method returns the minimum value stored in the stack.\n\n# Complexity\n- **Time complexity: O(1)**\n    - All operations (push, pop, top, and getMin) are performed in constant time, O(1).\n\n- **Space complexity: O(n)**\n    - The space complexity is O(n), where n is the number of elements pushed onto the stack.\n\n# Code\n```\npublic class MinStack {\n    Stack<(int val, int minVal)> stack; \n    int minVal = int.MaxValue;\n    public MinStack() {\n        stack = new Stack<(int, int)>();\n    }\n    \n    public void Push(int val) {\n        if(minVal > val)\n        {\n            minVal = val;\n        }\n        stack.Push((val, minVal));\n    }\n    \n    public void Pop() {\n        stack.Pop();\n        if(stack.Count > 0)\n        {\n            minVal = stack.Peek().minVal;\n        }\n        else\n        {\n            minVal = int.MaxValue;\n        }\n    }\n    \n    public int Top() {\n        return stack.Peek().val;\n    }\n    \n    public int GetMin() {\n        return stack.Peek().minVal;\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\n# Approach 2:\n# Code\n```\npublic class MinStack {\n    Stack<int> stack = null;\n    Stack<int> minStack = null;\n    int minValue = 0;\n    public MinStack() {\n        stack = new Stack<int>();\n        minStack = new Stack<int>();\n    }\n    public void Push(int val) {\n        if(stack.Count == 0)\n        {\n            minValue = val;\n        }\n        stack.Push(val);\n        minValue = Math.Min(minValue, val);\n        minStack.Push(minValue);\n    }\n    public void Pop() {\n        stack.Pop();\n        minStack.Pop();\n        if(minStack.Count > 0)\n        {\n            minValue = minStack.Peek();\n        }\n    }\n    public int Top() {\n        return stack.Peek();\n    }\n    \n    public int GetMin() {\n        return minValue;\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```
['Stack', 'Design', 'C#']