Skip to content

Commit 65a407d

Browse files
authored
Create 01 - Recursive Approach.cpp
1 parent 92169bb commit 65a407d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution {
2+
public:
3+
int nthFibonacci(int n) {
4+
if(n == 0 || n == 1) return n;
5+
6+
return nthFibonacci(n-1) + nthFibonacci(n-2);
7+
}
8+
};

0 commit comments

Comments
 (0)