hacktoberfest2021 icon indicating copy to clipboard operation
hacktoberfest2021 copied to clipboard

Count ways to reach the n’th stair

Open ritweekraj2802 opened this issue 3 years ago • 2 comments

There are n stairs, a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at a time. Count the number of ways, the person can reach the top.

Examples:

Input: n = 1 Output: 1 There is only one way to climb 1 stair

Input: n = 2 Output: 2 There are two ways: (1, 1) and (2)

Input: n = 4 Output: 5 (1, 1, 1, 1), (1, 1, 2), (2, 1, 1), (1, 2, 1), (2, 2)

Consider the example shown below in the diagram. The value of n is 3. There are 3 ways to reach the top.

Count ways to reach the n’th stair

I WANT TO ADD THIS PROBLEM TO DP SECTION

PLEASE ASSIGN THIS PROBLEM TO ME THANK YOU

ritweekraj2802 avatar Oct 03 '21 10:10 ritweekraj2802

Please assing me this issue. I might have most optimised approach to this problem

shashwat010 avatar Oct 06 '21 11:10 shashwat010

PLEASE Accept MY PR . THANK U.

ritweekraj2802 avatar Oct 06 '21 11:10 ritweekraj2802