Leetcode in Java && Oracle
420 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-11-01_18-31-53.png
25 KB
#N509. Fibonacci Number
problem link=>https://leetcode.com/problems/fibonacci-number/

#solution
class Solution {
public int fib(int n) {
return F(n);
}

int F(int n){
int sum=0;
if(n==0) return 0;
if(n==1) return 1;
return F(n-2)+F(n-1);
}
}