You are trying to climb on a staircase. There are N number of steps. You can only climb one or two steps at one time. Now you have to find out the number of possible combinations to reach the final step
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
To find out the possible combination to reach the last step is a problem of combination. We are using the Dynamic programming approach to solve it with less time complexity.
To solve this problem, we will follow these steps,
Let f(i)= no. Of possible combination to reach the ith step. f(i)= f(i-1) +f(i-2)
C++ Implementation:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer