We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Strings
- Palindrome Index
- Discussions
Palindrome Index
Palindrome Index
Sort by
recency
|
1108 Discussions
|
Please Login in order to post a comment
Here is my solution. so before code this. i am trying to imagine how the palindrome works. and i found that. you only need to check first wrong character (first wrong from left, and first wrong from right)
then what i do next ? I try to remove wrong character in left, check whether it is already palindrome. if no then i try to remove wrong character in right. if it is still not palindrome then there is no solution.
Here is my C++ solution
}
Can't for the life of me figure out what's wrong with my solution - it passes 12/15 test cases.
Python Complexity:O(n)