We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1fc72b commit 7de0a50Copy full SHA for 7de0a50
README.md
@@ -64,8 +64,8 @@ JavaScript implementation:
64
* @return number
65
*/
66
function getFibonacciNumberRecursive(N) {
67
- if (N <= 1) {
68
- return N;
+ if (N <= 2) {
+ return N < 1 ? 0 : 1;
69
}
70
return getFibonacciNumberRecursive(N - 1) + getFibonacciNumberRecursive(N - 2);
71
@@ -184,8 +184,8 @@ const memo = {};
184
185
186
187
188
189
190
if (!memo[N]) {
191
memo[N] = getFibonacciNumberRecursive(N - 1) + getFibonacciNumberRecursive(N - 2);
0 commit comments