×

# PERMPAL Unofficial Editorial

 4 Hello Community! I wanted to contribute to the community but since I don't have enough karma points, I want you to upvote only if you like my unofficial editorial on PERMPAL: My approach: The answer will be -1 only when the count of any of 26 characters is odd and there exists more than one such character's example : abbc, here we can see both 'a' and 'c' have odd count in the given string. In any other case, we will always find a answer, that is palindrome. Based on above point, we will deal with two cases : (A)When only one character comes with odd count and rest other characters with even count. (B)When all the character in the given string are of even count. Now the question comes How to solve this? So it is much clear for case 3(A) that the odd count characters should be in the middle of string in order to make it palindrome, eg abbba n(b)=3 i.e odd Since the ordering of characters won't matter in case of even count, we will print index one by one from vector> v(26), which I have used this for storing the index of each character(a-z) in the string. In the output I need to just print the even count characters index ,simultaneously from beginning and end. Keep in mind that the odd count character should be in the middle. If you give up, you can see my solution here. All suggestions are welcome! Thanks Community, Happy Coding! asked 13 Feb, 12:25 162●1●7 accept rate: 0% 3.7k●21●72 I have updated the formatting of certain things. Hope you didn't mind. Btw, Nice Editorial. (15 Feb, 19:47) Thanks a lot @taran_1407 :) (16 Feb, 17:44)

 0 Hello friends....I'm quite stuck on this solution since yesterday..I'm a newbie and tried to solve this question...however it's giving me WA..can you please tell me where I'm wrong in my code? link to code Thanks in advance!! answered 15 Feb, 19:31 1★tra_dax 2 accept rate: 0% This is your ac solution: https://www.codechef.com/viewsolution/17446057 U were trying to insert at position which didnt existed,(U may google about this as i dont often code with python) (15 Feb, 19:55) @vivek_1998299 thank you so much..you saved my day!! (16 Feb, 18:21) tra_dax1★
 0 https://www.codechef.com/viewsolution/17340080 Please can some one tell me what is wrong with my code?? answered 17 Feb, 01:19 2★veda_19 1●1 accept rate: 0%
 0 @veda_19 Hi ! You can check out my solution https://www.codechef.com/viewsolution/17287463 I've used Hashing and fast IO. The logic is to get a new string and obtain its mid-point. Then add to the left and right of that mid-point the alphabets that occur even. For odd alphabets simply put them in between the new String. Hope I helped You ! Happy Coding :) answered 17 Feb, 02:04 1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,198
×232
×11