Theocacao
Leopard
Design Element
Comment on "Numeric Palindrome Finder in Ruby"
by Carl — Dec 05
Ah, brute force. The other method is to realize that palindromes must be mirror images.

So,
1 -> 11
2 -> 22

99 -> 9999

Those are the first 99 palindromes. Then you have issues where the center number is a pivot.

1->101, 111, 121, … 191. (ten items)

Since the limit is 10,000, the largest number you can get with this method is 9 -> 999.

Then add in numbers 0 through 9.

So, my guess is 99 + 90 + 9 = 198. Was I right?
Back to "Numeric Palindrome Finder in Ruby"
Design Element

Copyright © Scott Stevenson 2004-2015