Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fibonacci solution w/ recursion and memoization #268

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed trailing spaces
mateusmlo authored Dec 12, 2018
commit 7cb08f873af979712013fd27ea558c98c28b6ec6
4 changes: 2 additions & 2 deletions src/algorithms/math/fibonacci/fibonacciRecursiveMemoized.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* memoize function use a Map to store function arguments
and results, which are returned if found inside cache */
and results, which are returned if found inside cache */
const memoize = (fn) => {
const cache = new Map();

@@ -13,7 +13,7 @@ const memoize = (fn) => {
};

/* fibonacci function decorated with the memoize function, every call
will first pass through the cache before it's computed */
will first pass through the cache before it's computed */
const fibonacci = memoize((n) => {
if (n === 0 || n === 1) return n;