MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / Solution

Class Solution

Recursion/Homework/nthStair.cpp:4–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4class Solution{
5 public:
6 int countWays(int n)
7 {
8 //code here
9
10 //Base Case
11 if (n==1 || n==2){
12 return n;
13 }
14
15 // Recursive Call
16 int recCall1 = countWays(n-1);
17 int recCall2 = countWays(n-2);
18
19 // Small Calculation
20 int smallCal = recCall1 + recCall2;
21
22 return smallCal;
23 }
24};
25
26
27

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected