solve Palindrome Partitioning II using 2 dp tables