text: /**
   * @param {number} amount
   * @param {number[]} coins
   * @return {number}
   */
  var change = function(amount, coins) {
    const dp = Array(amount + 1).fill(0);
    dp[0] = 1;
  
    for (const coin of coins) {
      for (let i = coin; i <= amount; i++) {
        dp[i] += dp[i - coin];
      }
    }
  
    return dp[amount];
  };
  
  // time:  O(n)
  // space: O(m)
  
  // 1, [1]
  // 1, [2]
  // 3, [2]
  // 5, [1, 2, 5]
  