DP filling array order?

My DP skills are mediocre but most of the time I'm able to get the recurrence relation. However, one part I'm struggling with is how to see in what way to fill the dp array.

Sometimes it is obvious how it should be filled but sometimes I don't exactly know how.

(And then it is even more of a struggle with 1D arrays when we're optimizing space complexity.)

Is there any method to easily figure out the order to fill or visualize the order of filling a DP array? Would appreciate any advice beyond just looking at the recurrence relation and seeing.

Comments (2)