| 4 | class 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 |