Tree DP
Use a hashmap or memoize a value at each treenode.
We always DP on subtrees. It is just for all the problems we have encountered so far - these subtrees are implicitly represented by a recurrence. Now we are memoizing them on a real tree data structure.
Last updated