Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. function bool isPalindrome(String input)
  2. {
  3. int len = input.length();
  4.  
  5. bool isPalindrome = true;
  6.  
  7.  
  8. // only have to iterate through half the length of the string
  9. for(j = 0; j<len/2; j++)
  10. {
  11. if(input[j] != input[len - 1 -i])
  12. {
  13. isPalindrome = false;
  14. break;
  15.  
  16. }
  17. }
  18.  
  19. return isPalindrome;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement