palindrome partitioning reimpl: use a local 2D buffer