Skip to content

Instantly share code, notes, and snippets.

@kahwee
Created July 26, 2016 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kahwee/c128d91365977cbdffeec133ee8618ef to your computer and use it in GitHub Desktop.
Save kahwee/c128d91365977cbdffeec133ee8618ef to your computer and use it in GitHub Desktop.
Steps problems question

Given n being the number of steps, how many ways can you climb the stairs if you can step 1, 2 or 3 steps at a time.

0: []
1: [1]
2: [1, 1], 
   [2]
3: [1, 1, 1], 
   [2, 1], 
   [1, 2], 
   [3]
4: [1, 1, 1, 1], 
   [2, 1, 1], 
   [1, 2, 1], 
   [1, 1, 2], 
   [2, 2],
   [3, 1], 
   [1, 3]
5: [1, 1, 1, 1, 1], 
   [2, 1, 1, 1], 
   [1, 2, 1, 1], 
   [1, 1, 2, 1], 
   [1, 1, 2, 2], 
   [2, 2, 1],
   [1, 2, 2],
   [2, 1, 2],
   [3, 1, 1], 
   [1, 3, 1],
   [1, 1, 3], 
   [3, 2], 
   [2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment