Skip to content

Instantly share code, notes, and snippets.

@zwass
Created December 11, 2012 22:48
Show Gist options
  • Save zwass/4263062 to your computer and use it in GitHub Desktop.
Save zwass/4263062 to your computer and use it in GitHub Desktop.
One-liner brute force solution to Project Euler problem 4 (http://projecteuler.net/problem=4)
print sorted([int(c) for c in [str(x * y)
for x in range(999, 99, -1)
for y in range(999, x - 1, -1)]
if all([c[i] == c[-1 - i]
for i in range(len(c) / 2)])])[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment