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[]} num
   * @param {number} k
   * @return {number[]}
   */
  
  var addToArrayForm = function(num, k) {
      var i = num.length - 1, carry = 0;
      while (i >= 0 && k > 0) {
          var sum = num[i] + (k % 10) + carry;
          num[i] = sum % 10;
          carry = Math.floor(sum / 10);
          i--;
          k = Math.floor(k / 10);
      }
      if (i < 0) {
          k += carry;
          while (k > 0) {
              num.unshift(k % 10);
              k = Math.floor(k / 10);
          }
      } else {
          for (var j = i; j >= 0; j--) {
              var sum = num[j] + carry;
              num[j] = sum % 10;
              carry = Math.floor(sum / 10);
          }
          if (carry) {
              num.unshift(carry);
          }
      }
      return num;
  };
  