The space and time complexity of this approach is pretty straightforward.
You can see that we are using a 2D DP array over here.
So that's why the space complexity is of the order of n squared, where n is the length of the string
which is given to us, and the time complexity is of the order of n squared.
Again, the reason for this is the number of substrings that can be formed from a string of length n,
so the number of substrings that can be formed is of the order of n square.
And for each substring we are doing constant time operations.
Now, we have discussed this in great detail when we discussed the time complexity for the tabulation
approach for the palindromic substrings question, and the same reason applies over here as well.
So the time complexity is of the order of n square.