Recursive Permutations (w/ 1 & 2 to n)

PHOTO EMBED

Sat Feb 20 2021 21:47:55 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user] #java

public int climbStairs(int n) {
        int[] previousClimbs = new int[n + 1];
        previousClimbs[0] = 1;
        previousClimbs[1] = 1;
        for(int i = 2; i <= n; i++) {
            previousClimbs[i] = previousClimbs[i -1] + previousClimbs[i - 2];
        }
        
     return previousClimbs[n];
 }
content_copyCOPY

For many problems w/ 2 different options for each step of constructing something. (Ex: n long pathway with tiles made up of 1 and 2 spaces).