text: // Hi, I'm Yanzhan. I'm interested in all kinds of algorithmic problems. Also, I'm fascinated with javascript. If you want to learn more about programming problems and javascript, please visit my Youtube Channel (https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber), Twitter Account (https://twitter.com/YangYanzhan), GitHub Repo (https://github.com/yangyanzhan/code-camp) or HomePage (https://yanzhan.site/).
  
  // 开始分析
  // 1. 缓存最小值的中间结果即可。
  // 结束分析
  
  // 开始编码
  
  /**
   * initialize your data structure here.
   */
  
  var MinStack = function() {
      this.stack = [];
      this.mins = [];
  };
  
  /**
   * @param {number} x
   * @return {void}
   */
  
  MinStack.prototype.push = function(x) {
      if (this.mins.length > 0) {
          this.mins.push(Math.min(this.mins[this.mins.length - 1], x));
      } else {
          this.mins.push(x);
      }
      this.stack.push(x);
  };
  
  /**
   * @return {void}
   */
  
  MinStack.prototype.pop = function() {
      this.mins.pop();
      this.stack.pop();
  };
  
  /**
   * @return {number}
   */
  
  MinStack.prototype.top = function() {
      return this.stack[this.stack.length - 1];
  };
  
  /**
   * @return {number}
   */
  
  MinStack.prototype.min = function() {
      return this.mins[this.mins.length - 1];
  };
  
  /**
   * Your MinStack object will be instantiated and called as such:
   * var obj = new MinStack()
   * obj.push(x)
   * obj.pop()
   * var param_3 = obj.top()
   * var param_4 = obj.min()
   */
  