PROBLEM LINK:Author: Praveen Dhinwa DIFFICULTY:SIMPLE PREREQUISITES:None PROBLEM:Given a string $s[1\sim n]$, does there exist a permutation $p$ of $1,2,\dots,n$ such that, if we let $t[i]=s[p[i]]$, then $t$ is palindrome? EXPLANATION:This problem is equivalent to: can we rearrange the characters of $s$ into a permutation? Let's count the number of occurrences of every characters in If there are two chars $c_1,c_2(c_1\ne c_2)$ such that both $cnt[c_1]$ and $cnt[c_2]$ is odd, then the answer is no.
The converse is also true: if there are at most $1$ characters $c$ with $cnt[c]$ odd, then the answer is yes. Here is one of the constructions.
ALTERNATIVE SOLUTIONSThis is a constructive problem. I think there'll be many solutions. Please feel free to share your solution. AUTHOR'S AND TESTER'S SOLUTIONS:Author's solution can be found here.
This question is marked "community wiki".
asked 30 Jan, 19:23

Here is my solution https://www.codechef.com/viewsolution/17423799. please help me finding my mistake i am unable to find it. answered 12 Feb, 15:31
You are not outputting a correct permutation. The string generated by your permutation is not a palindrome. Check your solution on the following test cases.
(12 Feb, 16:11)
thank you so much. found the mistake :)
(12 Feb, 18:01)

Can someone please help me in finding the problem in my code. Here is the link https://www.codechef.com/viewsolution/17394429 answered 13 Feb, 23:12

https://www.codechef.com/viewsolution/17340080 Can anyone tell me what was wrong with my solution?? answered 15 Feb, 03:46

This is my solution https://www.codechef.com/viewsolution/17360282. It works only for subtask #1. can anyone please tell me what went wrong with my solution? answered 26 Feb, 14:02
