longestPalindrome   accepted by LC

space 1 time n square
wordBreak   exceeded time limit