Lecture 18 Flashcards

1
Q

Fibonacci using recursion code

A
int fibonacci(int n) {
     if(n == 0 || n == 1) {
          return 1;
     } else {
          return fibonacci(n-2) + fibonacci(n-1);
     }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly