Partitions of a string

Правка en1, от 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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский silentknight00 2018-09-11 05:39:03 828 Initial revision (published)