Skip to content

Instantly share code, notes, and snippets.

@nevill
Created April 24, 2013 16:09
Show Gist options
  • Save nevill/5453356 to your computer and use it in GitHub Desktop.
Save nevill/5453356 to your computer and use it in GitHub Desktop.
String::reverse = ->
size = @length + 1
result = ""
while size -= 1
result += @[size - 1]
result
String::reversable = ->
@reverse() == @toString()
numbers = [999..901]
resultSet = []
dict = []
for i in numbers
continue if i % 10 == 0
for j in numbers
continue if j % 10 == 0
num = i * j
resultSet.push num if num.toString().reversable()
dict[num] = { i: i, j: j }
max = Math.max.apply null, resultSet
console.log max
console.log dict[max]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment