DP25, marked it CODE; memoization on tree