> For the complete documentation index, see [llms.txt](https://algorithm.prettylog.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://algorithm.prettylog.com/algorithm-problems/algoexpert/medium/number-of-ways-to-make-change.md).

# Number Of Ways To Make Change

![](/files/87GOHwxKvBLXtstb8TVz)

* d x n, n

```jsx
function numberOfWaysToMakeChange(n, denoms) {
  const arr = new Array(n + 1).fill(0);
  arr[0] = 1;
  
  for (const denom of denoms) {
    for (let i = 0; i < n + 1; i++) {
      if (denom > i) continue;
      arr[i] = arr[i] + arr[i - denom];
    }
  }

  return arr[n];
}

// Do not edit the line below.
exports.numberOfWaysToMakeChange = numberOfWaysToMakeChange;
```
