Any solution other than brute

Revision en1, by suryamanikantatankala, 2022-09-07 16:13:39

You are having a string S of length N containing only lowercase English letters. You perform the following operation on the above string: Delete some substring of this string. Try permuting the remaining characters of the string such that they become a palindrome.

Determine the minimum length substring to remove from the string S such that the remaining characters can be rearranged into a palindrome.

Samples:

Sample input 1: 2 7 abbcdde 5 abcdc

Sample output 1: 4 2

Sample input 2: 2 2 gx 5 puamk

Sample output 2: 1 4

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English suryamanikantatankala 2022-09-07 16:13:39 607 Initial revision (published)