In Ruby, one easy way to check for palindromes would be to write a method such as this:
class String
def palindrome?
self == self.reverse
end
end
But the C++ part of my brain screams that this is likely to be very inefficient. So, today’s kata: test-drive a palindrome? method for String, ensuring (with tests) that it is much faster than the above.
