Check if string is palindrome or not

Beginner Problems Basic Recursion Easy
  • Palindrome problems or algorithms are often used in the development of natural language processing technologies, like chatbots and digital assistants
  • The performance of these technologies significantly depends on their capability of detecting and understanding patterns, including palindromes, in natural language
  • This helps in analyzing sentences better, understanding contexts, improving user experience, and adding a pinch of humor
  • For example, a chatbot could be programmed to identify palindromes and respond with a humorous reply when a user inputs a palindromic phrase

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 string when reversed is --> "hannah", which is same as original string , so we return true.

Input : s = "aabbaaa"

Output : false

Explanation : The string when reversed is --> "aaabbaa", which is not same as original string, So we return false.

Input : s = "aabbcccdbbaa"

Constraints

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

Company Tags

TCS Cognizant Accenture Infosys Capgemini Wipro IBM HCL Tech Mahindra MindTree