palindrom partitioning with memoization
code for the prev commit