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. 按定义执行即可。
  // 结束分析
  
  // 开始编码
  
  var RecentCounter = function() {
      this.nums = [];
  };
  
  /**
   * @param {number} t
   * @return {number}
   */
  
  RecentCounter.prototype.ping = function(t) {
      this.nums.push(t);
      for (var i = this.nums.length - 1; i >= 0; i--) {
          if (t - 3000 > this.nums[i]) {
              return this.nums.length - 1 - i;
          }
      }
      return this.nums.length;
  };
  
  /**
   * Your RecentCounter object will be instantiated and called as such:
   * var obj = new RecentCounter()
   * var param_1 = obj.ping(t)
   */
  