Partitions of a string

Revision en1, by silentknight00, 2018-09-11 05:39:03

The Problem Statement is :

Bob is given a string. But Bob only likes palindromes, and now wants to partition the string into palindromes. However, after his friends told him his demands are simply exorbitant, Bob has chosen to relax his conditions. He has agreed to rearranging the partitions himself to make palindromes, so is now looking to partition the string into such ’possible’ palindromes. As always, help Bob to find the minimum partitions needed for his demand to be met.

Sample TestCase

Input — aabxyyzz Output-2

Explanation:The string can be partitioned as aab | xyyzz, since these partitions can bere-arranged to aba, yzxzy, both of which are palindromes

Input — abcdefghijklmnopqrstuvwxyz Output-26

Can any explain how one should approach such problems?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English silentknight00 2018-09-11 05:39:03 828 Initial revision (published)