String | Palindrome
What is a Palindrome String?
A string is called a palindrome if the reverse of the string is the same as the original one.
Example: “madam”, “racecar”, “12321”.
Properties of a Palindrome:
A palindrome string has some properties which are mentioned below:
- A palindrome string has a symmetric structure which means that the character in the first half of the string are the same as in the rear half but in reverse order.
- Any string of length 1 is always a palindrome.
How to identify a Palindrome?
We can follow the below steps to identify a palindrome:
- Depending on the case sensitivity, either turn all the characters to lowercase or uppercase or keep them as it is.
- Now, Compare the first and the last character. If they are the same move to the second and second last and so on.
- If all the pairs of characters match, then it is a palindrome, otherwise not.
Easy Problems on Palindrome:
- C Program to Check if a Given String is Palindrome
- Recursive function to check if a string is palindrome
- Sentence Palindrome (Palindrome after removing spaces, dots, .. etc)
- Check if actual binary representation of a number is palindrome
- Print longest palindrome word in a sentence
- Count palindrome words in a sentence
- Check if characters of a given string can be rearranged to form a palindrome
- Lexicographically first palindromic string
- Longest Non-palindromic substring
- Minimum insertions to form a palindrome with permutations allowed
- Smallest Palindrome after replacement
- Remove a character from a string to make it a palindrome
- Program to print all palindromes in a given range
- Sum of first K even-length Palindrome numbers
Medium Problems on Palindrome:
- Minimum removal to make palindrome permutation
- Print the arranged positions of characters to make palindrome
- Check if a given string is a rotation of a palindrome
- Make largest palindrome by changing at most K-digits
- Minimum number of deletions to make a string palindrome
- Find longest palindrome formed by removing or shuffling chars from string
- Print all palindrome permutations of a string
- Find all palindromic sub-strings of a given string
- Count of Palindromic substrings in an Index range
- Longest Possible Chunked Palindrome
- Largest palindromic number by permuting digits
- Make a lexicographically smallest palindrome with minimal changes
- Number of strings of length N with no palindromic sub string
- Check if any anagram of a string is palindrome or not
- Count maximum-length palindromes in a String
- Next higher palindromic number using the same set of digits
Hard Problems on Palindrome:
- Minimum insertions to form a palindrome | DP-28
- Longest Palindromic Substring
- Online algorithm for checking palindrome in a stream
- Palindrome Partitioning | DP-17
- Print all palindromic partitions of a string
- Count All Palindromic Subsequence in a given String
- Print Longest Palindromic Subsequence
- Minimum characters to be added at front to make string palindrome
- Palindrome Substring Queries
- Palindrome pair in an array of words (or strings)
- Minimum steps to delete a string after repeated deletion of palindrome substrings
- Given a number, find the next smallest palindrome
- Closest Palindrome Number (absolute difference Is min)
- Count palindromic characteristics of a String
- Number of positions where a letter can be inserted such that a string becomes palindrome
- Minimum equal palindromic cuts with rearrangements allowed
- Palindrome by swapping only one character
Quick Links:
- Recent articles on Palindrome
- ‘Practice Problems’ on Strings
- ‘Quizzes’ on Strings