Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

What is the minimum number of cuts needed to split "racecarxyz" into pieces that are all palindromes?

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

Correct answer: D. 3

Only racecar is a palindrome among the long pieces, so xyz must be cut into single letters, and the minimum is 3 cuts: racecar | x | y | z.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic