public override void Run(string[] args) { var ms = new MaxStack(); ms.Push(2); ms.Push(3); ms.Push(6); ms.Push(1); ms.Push(5); ms.Push(4); Debug.Assert(() => ms.PeekMax(), 6); ms.PopMax(); Debug.Assert(() => ms.PeekMax(), 5); }
static void Main(string[] args) { var stack = new MaxStack(); //stack.Push(5); stack.Push(1); stack.Push(5); stack.Push(3); stack.Top(); stack.PopMax(); stack.Top(); stack.PeekMax(); stack.Pop(); stack.Top(); Console.WriteLine(); }