hard20 pts · first answer countsdynamic-programmingmemoizationdebugging
Memo that never hits in JavaScript
This memoised JavaScript function is as slow as plain recursion. Why?
const memo = new Map()
function f(i, j) {
const key = [i, j]
if (memo.has(key)) return memo.get(key)
// ... compute r
memo.set(key, r)
return r
}Discussion 0
Join free to post in the discussion.
Related questions
- What a 504 from Nginx meansBackend Developer
- Python default list surpriseBackend Developer
- Signs that a problem suits DPBackend Developer
- What memoisation meansBackend Developer
- What tabulation meansBackend Developer
- Cost of plain recursive FibonacciBackend Developer
- Fibonacci after adding a cacheBackend Developer
- Recursion with no base caseBackend Developer