示例#1
0
        static void Main(string[] args)
        {
            MinStack minStack = new MinStack();

            minStack.push(-2);
            minStack.push(0);
            minStack.push(-3);
            Console.WriteLine("min: " + minStack.getMin());  // --> Returns - 3.
            minStack.pop();
            Console.WriteLine("top: " + minStack.top());     // --> Returns 0.
            Console.WriteLine("min: " + minStack.getMin());; // --> Returns - 2.
        }
示例#2
0
        static void Main(string[] args)
        {
            MinStack minStack = new MinStack();

            minStack.Push(-2);
            minStack.Push(0);
            minStack.Push(-3);
            minStack.GetMin();
            minStack.Pop();
            minStack.Top();
            minStack.GetMin();
        }