printing optimal solution of DP

Could someone please explain or post some code to help me understand how to use parent pointers in DP to print the optimal solution.

Like printing the longest common subsequence not just its length…

This is called reconstructing the solution. Will it be okay if I take another problem as an example, other than LCS?

Suppose in the recurrence, you had 3 options to chose, and the formula chose one of them, so while reconstructing the solution we will trace back and based on what choice was selected at a particular point, we will be filling out output string. This is just a hint.

Link1

@bugkiller Thanx!!
I got it…
The link did all the talking :slight_smile: