As I mentioned earlier, you need something else as well to reconstruct the subsequence:
= The index of the array where is achieved.
= For index , is the previous index in the subsequence ending at . If the subsequence starts at index i, then prev[i] = -1.
Choosing the right state (what each dp value represents) is often the hardest part. The state must capture everything needed to solve the subproblem independently.
Before moving to the next unit, try to think: if is "best subsequence ending at value ", how should you update it when you see a new element in the array?