Palindrome Check

Think before you code.

Return true if a string reads the same forward and backward.

easy

Palindrome Check

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.

Example 1

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.

Example 2

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.

Constraints

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