Skip to content

Instantly share code, notes, and snippets.

@akayj
Last active November 17, 2015 05:55
Show Gist options
  • Save akayj/c8071a9d2a8236d4fe67 to your computer and use it in GitHub Desktop.
Save akayj/c8071a9d2a8236d4fe67 to your computer and use it in GitHub Desktop.
Palindrome_2
# -*- coding: utf-8 -*-
def palindrome(s):
a = 0
b = len(s) - 1
while a < b:
if s[a] != s[b]:
return False
a, b = a+1, b-1
return True
@akayj
Copy link
Author

akayj commented Nov 17, 2015

Detect a string or unicode string is a palindrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment