We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 86d6a59 commit b0f81f1Copy full SHA for b0f81f1
DynamicProgramming/Fibonacci.java
@@ -88,7 +88,7 @@ private static int fibOptimized(int n) {
88
return 0;
89
}
90
int prev = 0, res = 1, next;
91
- for (int i = 2; i < n; i++) {
+ for (int i = 2; i <= n; i++) {
92
next = prev + res;
93
prev = res;
94
res = next;
0 commit comments