GATE Computer ScienceVery hardGATE CS (PYQ pattern)

What is the minimum number of cuts needed to partition the string abacbbcabbacab into substrings that are all palindromes?

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

Correct answer: C. 2

The DP cut[j] = min over i with s[i..j] palindrome of cut[i − 1] + 1 gives 2, for example a | bacbbcab | bacab (confirmed by brute force over all cut sets, which also shows no single cut works). Zero cuts would require the whole string to be a palindrome, which it is not.

More Algorithms questions

Exams that ask this topic