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

Now Your Turn!

Pick the correct output for the given input

Input : s = "aabbccbbaa"

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= s.length <= 105
  • s consist of only uppercase and lowercase English characters.
0
class Solution{
public:
bool palindromeCheck(string& s){
//your code goes here
}
};
Test Case

Input:

Nums
S