Home [Easy] Fibonacci Number
Post
Cancel

[Easy] Fibonacci Number

‘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); 
    }
}
This post is licensed under CC BY 4.0 by the author.

[Medium] Sort List

[Easy] Power of Two

Comments powered by Disqus.