2 ms·
In eg Python you can just add a memoization decoration, and get a linear solution from the naive recursive one. That's pretty neat.
by eru 6y ago
In eg Python you can just add a memoization decoration, and get a linear solution from the naive recursive one.
That's pretty neat.
- dotancohen 6y agoIn almost any language, a hashtable check after the base case check could be used in a similar manner.
- eru 6y agoYes. I just singled out Python, because the language is well-known, and adding the memoization is particularly straight-forward.