Last active
May 27, 2018 18:43
-
-
Save thmain/c258434e3a6830ff4ca0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Fibonacci{ | |
public static int fibDP(int x) { | |
int fib[] = new int[x + 1]; | |
fib[0] = 0; | |
fib[1] = 1; | |
for (int i = 2; i < x + 1; i++) { | |
fib[i] = fib[i - 1] + fib[i - 2]; | |
} | |
return fib[x]; | |
} | |
public static void main(String[] args){ | |
System.out.println(fibDP(10)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment