Palindrome Check

Beginner Problems Basic Strings Easy
  • Palindrome checking algorithms, similar to the problem statement, have interesting implications in the development of DNA sequence analysis tools used in Bioinformatics
  • Since DNA can be read in both directions, identifying palindromic sequences is a key in the detection of special genetic markers called Restriction sites, essential in Genetic Engineering
  • Even simple programming challenges have enormous potential in real world applications!

You are given a string s. Return true if the string is palindrome, otherwise false. A string is called palindrome if it reads the same forward and backward.

Examples:

Input : s = "hannah"

Output : true

Explanation : The given string when read backward is -> "hannah", which is same as when read forward.

Hence answer is true.

Input : s = "aabbaaa"

Output : false

Explanation : The given string when read backward is -> "aaabbaa", which is not same as when read forward.

Hence answer is false.

Input : s = "aabbccbbaa"

Constraints

  • 1 <= s.length <= 105
  • s consist of only uppercase and lowercase English characters.

Company Tags

TCS Cognizant Accenture Infosys Capgemini Wipro IBM HCL Tech Mahindra MindTree