Palindrome String InterviewBit Solution
Updated: Sep 10, 2020
Problem: Palindrome String
Problem Description:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Example:
"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a palindrome.Return 0 / 1 ( 0 for false, 1 for true ) for this problem.
Approach:
For the given problem, we have to convert the string into either upper case or lower case.
After that, we will omit the special characters and will consider only those characters containing which are either alphabets or digits.
Then we can compare the generated string with its reverse form if both strings are equal then the given string is a palindrome, otherwise not.
Time & Space Complexity:
Time Complexity: O(N) // As we are only traversing the stringSpace Complexity: O(1)Solution:
Code in C++



https://applepaycasino24.de is where my mind wandered when the post mentioned returning 0 or 1, since that binary simplicity feels a lot like the win-or-lose logic in games. The part about skipping special characters and ignoring case is the detail I always trip over in interviews, because it's easy to forget the two-pointer check breaks the moment you compare raw characters. I've started cleaning the string first and then comparing, which sounds obvious but has saved me more than once.