using System.Collections.Generic;
class Solution
{
Stack<int> sta1 = new Stack<int>();
Stack<int> sta2 = new Stack<int>();
public void push(int node)
{
sta1.Push(node);
if(sta2.Count == 0 || node <= sta2.Peek()) sta2.Push(node);
}
public void pop()
{
int cur = sta1.Pop();
if(cur == sta2.Peek()) sta2.Pop();
}
public int top()
{
return sta1.Peek();
}
public int min()
{
return sta2.Peek();
}
}


京公网安备 11010502036488号