3 ms·
I can't read ruby, but here's something a little smarter than brute force in C (on its way to DP, but I couldn't be arsed to work out the recurrence so I just i
by leif 16y ago
I can't read ruby, but here's something a little smarter than brute force in C (on its way to DP, but I couldn't be arsed to work out the recurrence so I just iterated until it stabilized): http://gist.github.com/617854 http://gist.github.com/617854
- dasil003 16y agoIt looks similar to mine, but you got lucky (or unlucky depending on how you look at it) that the longest palindrome had an odd character count. The confusing bits in the Ruby are actually just the definition of an even and odd palindrome finder, which are the same except for two seed values for where the first comparison is conducted and it's length.
- leif 16y agooh whoops nice catch thx