1

I recently started to read abour dynamic programming, and I am doing an exercise on it. The problem to solve: Given a String, find the least amount of palindromes it can be split into, and print out the solution. I found this article on here: Is there an algorithm for checking if a string is a catenation of palindromes?

It helps me, but I dont quite get the last step of the answer: Quote:

Now, you can compute s[1,…,j+1], by checking for each $1\le i\le j−1$ whether s[1,…,i] can be decomposed, and if s[i+1,…,j+1] is a palindrome (using the above 2D table). Giving a $\Theta(n^2)$ time and $\Theta(n^2)$ space algorithm.

What do I do here? I am confused.

RunOrVeith
  • 239
  • 1
  • 7

0 Answers0