Given a string, write a c function to check if it is palindrome or not.
A string is said to be palindrome if reverse of the string is same as string. For example, “abba” is palindrome, but “abbc” is not palindrome.
1) Find length of str. Let length be n.
2) Initialize low and high indexes as 0 and n-1 respectively.
3) Do following while low index ‘l’ is smaller than high index ‘h’.
…..a) If str[l] is not same as str[h], then return false.
…..b) Increment l and decrement h, i.e., do l++ and h–.
4) If we reach here, it means we didn’t find a mis
Following is C implementation to check if a given string is palindrome or not.
abba is palindrome abbccbba is palindrome geeks is Not Palindrome
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Python program to check if a string is palindrome or not
- Python program to check if given string is vowel Palindrome
- Check if a given string is a rotation of a palindrome
- Check if any anagram of a string is palindrome or not
- Check if it is possible to create a palindrome string from given N
- Check if a string is palindrome in C using pointers
- Check if there exists any sub-sequence in a string which is not palindrome
- Given two strings check which string makes a palindrome first
- Recursive function to check if a string is palindrome
- Check if a string can be rearranged to form special palindrome
- Check if characters of a given string can be rearranged to form a palindrome
- Program to check if an Array is Palindrome or not using STL in C++
- Program to check the number is Palindrome or not
- Program to check if an Array is Palindrome or not
- Check if the characters in a string form a Palindrome in O(1) extra space
Improved By : AbhijeetPrakash