Example #1
0
 public void Push(int x)
 {
     if (head == null)
     {
         head = new NodeWithMin(x, x, null);
     }
     else
     {
         head = new NodeWithMin(x, Math.Min(x, head.min), head);
     }
 }
Example #2
0
 public NodeWithMin(int val, int min, NodeWithMin next)
 {
     this.val  = val;
     this.min  = min;
     this.next = next;
 }
Example #3
0
 public void Pop()
 {
     head = head.next;
 }