Understanding the top down solution to the longest palindromic subsequence problem


To solve the longest palindromic subsequence problem using a top-down dynamic programming approach, we translate the recurrence relation into a recursive function and use a memoization table to store results of subproblems that have already been solved.

The top down solution

As with any top-down solution, there is a recursive function that solves subproblems and a calling function that initializes the required data structures and triggers the computation.

Liking the course? Check our discounted plans to continue learning.