Skip to content

Latest commit

 

History

History

Count Ways to Reach the Nth Stair Using Step 1, 2 or 3

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible ways the child can run up the stairs.

There are two methods to solve this problem

  • Recursive Method
  • Dynamic Programming
Input : 4
Output : 7
1 -> 1 -> 1 -> 1
1 -> 1 -> 2
1 -> 2 -> 1
1 -> 3
2 -> 1 -> 1
2 -> 2
3 -> 1


Input : 3
Output : 4