2
$\begingroup$

When I'm working on a algorithm problem, I can usually find a top-down solution that works with recursion.

Then for optimization purpose I try to do a bottom-up approach (dynamic programming) to remove the recursion stack, and I struggle. I have a really hard time initializing the array with the correct value, and then fill it with the answers to the sub problems.

Do you have any recommendations / tips on how to "convert" a top-down solution to a bottom-up algorithm?

$\endgroup$