Phase : Build isPalin table. Iterate by length. = true. = ( == ). For longer: check ends match and inner is palindrome. Phase : Compute for each position. Check if whole prefix is palindrome ( cuts). Otherwise try all valid last palindrome positions. Answer is . Time: , Space: for isPalin table. Trace through a small example to verify your understanding before moving on.
Time complexity: .
Space complexity: .