FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaDataStructures/DynamicProgramming/Fibonacci.java at master · benaich/JavaDataStructures · GitHub
benaich
/
JavaDataStructures
Public
Notifications
You must be signed in to change notification settings
Fork
7
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaDataStructures
/
DynamicProgramming
/
Fibonacci.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (16 loc) · 461 Bytes
Breadcrumbs
JavaDataStructures
/
DynamicProgramming
/
Fibonacci.java
Copy path
File metadata and controls
20 lines (16 loc) · 461 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package
DynamicProgramming
;
import
java
.
util
.
HashMap
;
public
class
Fibonacci
{
public
static
HashMap
<
Integer
,
Integer
>
tab
=
new
HashMap
<>();
public
static
int
get
(
int
i
) {
if
(
i
==
0
||
i
==
1
){
tab
.
put
(
i
,
i
);
}
else
{
tab
.
put
(
i
,
get
(
i
-
1
) +
get
(
i
-
2
));
}
return
tab
.
get
(
i
);
}
public
static
void
main
(
String
[]
args
) {
System
.
out
.
println
(
"fib(3) = "
+
Fibonacci
.
get
(
3
));
}
}
Back
|
FazBrowse Home
|
New Git URL