Last active
September 6, 2019 13:23
-
-
Save jadechip/2727a301e27ab6795b92755c93d96b75 to your computer and use it in GitHub Desktop.
Programming challanges: Is Palindrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# O(n) | |
def isPalindrome(string): | |
left = 0 | |
right = len(string) - 1 | |
while left < right: | |
if string[left] == string[right]: | |
left += 1 | |
right -= 1 | |
else: | |
return False | |
return True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment