PALPALS -Getting WA

Can someone help me understand for which cases my code fails to give correct output
https://www.codechef.com/viewsolution/43283815

Just think about cone > ceven. is it always true that we cannot from a valid string?

1 Like

Is it not that if i’m not able to place my single count characters in a palindromic even string ,we are unable to create such a string …We cant use odd palindromic string …oh wait …while typing this …i realized we can use the odd length palindromic string as well…thanks man :slight_smile:

You can utilize the odd length palindromes just like you were doing for even length palindromes. Eg- If the count is 7, then 2 characters with frequency 1 can be accommodated like “xxyxxzxxx”.