palindrome check quizforexam code example
Example 1: Palindrome Checker
const palindrome = str = {
str = str.replace(/[\W+|_]/g, '').toLowerCase()
const str1 = str.split('').reverse().join('')
return str1 === str
}
palindrome("My age is 0, 0 si ega ym.");
Example 2: check palindrome
bool isPlaindrome(string s)
{
int i=0;
int j=s.length()-1;
while(i<j)
{
if(s[i]==s[j])
{i++;
j--;}
else break;
}
if (i==j || i>j) return 1;
else return 0;
}