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

Method countWays

Recursion/Homework/nthStair.cpp:6–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.45

Calls 1

countWaysFunction · 0.50

Tested by

no test coverage detected