Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/careercup/ctci
/ fibonacci
Method
fibonacci
java/Chapter 9/Introduction/Fibonacci.java:4–12 ·
view source on GitHub ↗
(int i)
Source
from the content-addressed store, hash-verified
2
3
public
class
Fibonacci {
4
public
static
int
fibonacci(
int
i) {
5
if
(i == 0) {
6
return
0;
7
}
8
if
(i == 1) {
9
return
1;
10
}
11
return
fibonacci(i - 1) + fibonacci(i - 2);
12
}
13
14
/**
15
* @param args
Callers
1
main
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected