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. 前缀和。
  // 结束分析
  
  // 开始编码
  
  /**
   * @param {number[]} a
   * @return {number[]}
   */
  
  var constructArr = function(a) {
      var b1 = [], b2 = [];
      var p = 1;
      for (var i = 0; i < a.length; i++) {
          p *= a[i];
          b1.push(p);
      }
      p = 1;
      for (var i = a.length - 1; i >= 0; i--) {
          p *= a[i];
          b2.push(p);
      }
      var res = [];
      for (var i = 0; i < a.length; i++) {
          var p1 = 1, p2 = 1;
          if (i > 0) {
              p1 = b1[i - 1];
          }
          if (i < a.length - 1) {
              p2 = b2[a.length - 1 - i - 1];
          }
          res.push(p1 * p2);
      }
      return res;
  };
  