-
-
Save iizukak/3116031 to your computer and use it in GitHub Desktop.
project euler problem 4
This file contains hidden or 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
| #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