P [ i ] [ j ] = true if substring str [ i . . j ] is palindrome , else false
let P = new Array ( n ) ; for ( let i = 0 ; i < n ; i ++ ) { dp [ i ] = new Array ( n ) ; P [ i ] = new Array ( n ) ; for ( let j = 0 ; j < n ; j ++ ) { dp [ i ] [ j ] = 0 ; P [ i ] [ j ] = false ; } }