given string Is Palindrom?

function bool isPalindrome(String input)
{
 int len = input.length();
 
 bool isPalindrome = true;
 
 
// only have to iterate through half the length of the string
 for(j = 0; j<len/2; j++)
 {
  if(input[j] != input[len - 1 -i])
  {
   isPalindrome = false; 
   break;
   
  }
 }
 
 return isPalindrome;
}
Reactions

Post a Comment

0 Comments