Skip to content

Instantly share code, notes, and snippets.

@iizukak
Created July 15, 2012 09:11
Show Gist options
  • Select an option

  • Save iizukak/3116031 to your computer and use it in GitHub Desktop.

Select an option

Save iizukak/3116031 to your computer and use it in GitHub Desktop.
project euler problem 4
#project euler problem 4
#auther @iizukak
def isPalindrome(s):
for i in range(len(s) / 2):
if s[i] != s[- (i + 1)]:
return False
return True
def findPalindrome():
ans = 0
for i in range(1, 1000):
for j in range(1, i):
if isPalindrome(str(i * j)) and ans < i * j:
ans = i * j
return ans
print(findPalindrome())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment