Data Structures & AlgorithmsVery hardICPC regional · Product Company SDE

Problem: A string is a palindrome-partition target: what is the minimum number of cuts needed to split "abbacxcaxyyx" into palindromic pieces?

  1. A. 4
  2. B. 2
  3. C. 5
  4. D. 3

Correct answer: D. 3

Precompute palindrome status for all ranges, then run a DP over prefix cut counts. Greedy cutting at the first palindrome found is not optimal.

More Coding Interview Problems questions

Exams that ask this topic