Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4503910
fibonacci_memo.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
407 B
Referenced Files
None
Subscribers
None
fibonacci_memo.js
View Options
function
fibonacci
(
n
,
memo
=
{})
{
if
(
n
in
memo
)
return
memo
[
n
];
if
(
n
<=
1
)
return
n
;
memo
[
n
]
=
fibonacci
(
n
-
1
,
memo
)
+
fibonacci
(
n
-
2
,
memo
);
return
memo
[
n
];
}
const
start
=
performance
.
now
();
const
result
=
fibonacci
(
35
);
const
end
=
performance
.
now
();
console
.
log
(
`fibonacci(35) =
${
result
}
`
);
console
.
log
(
`Time:
${
(
end
-
start
).
toFixed
(
4
)
}
ms (
${
((
end
-
start
)
*
1000
).
toFixed
(
2
)
}
µs)`
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 3, 9:38 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
539818
Default Alt Text
fibonacci_memo.js (407 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment