‘Fibonacci Number (Easy)`
📌 Problem
https://leetcode.com/problems/fibonacci-number/
📌 Answer
1
2
3
4
5
6
7
class Solution {
public int fib(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
return fib(n - 2) + fib(n - 1);
}
}
Comments powered by Disqus.