MCPcopy Create free account
hub / github.com/appacademy/Module-1-Resources / somethingSlow

Function somethingSlow

w3/d4/lecture.js:140–147  ·  view source on GitHub ↗
(n, memo = {})

Source from the content-addressed store, hash-verified

138// fib
139let count = 0;
140function somethingSlow(n, memo = {}) {
141 count++;
142 if (n === 1 || n === 2) return 1;
143 // console.log('memo =>',memo)
144 if (memo[n]) return memo[n];
145 memo[n] = somethingSlow(n - 1, memo) + somethingSlow(n - 2, memo);
146 return memo[n];
147}
148
149console.log(somethingSlow(10000)); // 12586269025
150// console.log(count)

Callers 1

lecture.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected