Davis has a number of staircases in his house and he likes to climb each staircase , , or steps at a time. Being a very precocious child, he wonders how many ways there are to reach the top of the staircase.
Given the respective heights for each of the staircases in his house, find and print the number of ways he can climb each staircase, module on a new line.
Example
The staircase has steps. Davis can step on the following sequences of steps:
1 1 1 1 1
1 1 1 2
1 1 2 1
1 2 1 1
2 1 1 1
1 2 2
2 2 1
2 1 2
1 1 3
1 3 1
3 1 1
2 3
3 2
There are possible ways he can take these steps and
Function Description
Complete the stepPerms function using recursion in the editor below.
stepPerms has the following parameter(s):
int n: the number of stairs in the staircase
Returns
int: the number of ways Davis can climb the staircase, modulo 10000000007
Link to challenge : https://www.hackerrank.com/challenges/ctci-recursive-staircase/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=recursion-backtracking