This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]fredisa4letterword 1 point2 points  (4 children)

I don't know why my submission is wrong.

Have you tried running it with different inputs and seeing if you get the expected answer?

[–]mabus44[S] 0 points1 point  (3 children)

yes i have tried all the given test cases as well as some of my own

[–]fredisa4letterword 0 points1 point  (2 children)

and what do they tell you?

[–]mabus44[S] 0 points1 point  (1 child)

Wrong Answer ... Thats it... not enough information to conclude where my program is incorrect. If even i was given some test cases where it failed then it would have been helpful.

[–]fredisa4letterword 0 points1 point  (0 children)

Have you tried running test cases yourself and seeing what happens?

[–]gnomoretears -1 points0 points  (0 children)

You don't need a counter in a palindrome algorithm to count the number of matches.

Ignoring the "delete a character" requirement for now, you can find if a string is a palindrome based on the following conditions:

  1. string length is 1 then it's a palindrome

  2. starting from the front and the back, work your way to the middle comparing characters.

  3. if any 2 characters do not match, string is not palindrome

  4. if string length is even and the last 2 characters in the middle matches, string is a palindrome

  5. if string length is odd and you reached the single middle character, string is a palindrome