# Staircase Traversal ⇒ it is like the number of ways to change

![](https://3743232000-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHW2IQuh2PFpWJDvBz2FF%2Fuploads%2Fgit-blob-349e61b7f3fce7fe90f11220541258e82d95f07f%2FScreenshot%202023-01-25%20at%201.02.22.png?alt=media)

* n, n

```jsx
function staircaseTraversal(height, maxSteps) {
  let cases = new Array(height + 1).fill(0);
  cases[0] = 1;
  
  for (let i = 0; i < height + 1; i++) {
    for (let step = 1; step <= maxSteps; step++) {
      if (step > i) continue;
      cases[i] += cases[i - step];
    }
  }
  
  return cases[height];
}

// Do not edit the line below.
exports.staircaseTraversal = staircaseTraversal;

```
