Open In App

String | Palindrome

Last Updated : 22 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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”.

Palindrome String

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:

Medium Problems on Palindrome:

Hard Problems on Palindrome:

Quick Links:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads