vendredi 27 février 2015

How to determine how many number of palindromes can be formed from a given string?

I have a problem where I need to find a palindrome with lowest lexicographical value from the Input string.



Sample input- Sample output-

aabcc acbca


Explanation- Out of all the palindromes cabac and acbca, acbca is lowest lexicographically.


P.S- I want to do it in java.


Aucun commentaire:

Enregistrer un commentaire