- Joined
- Jul 3, 2010
- Messages
- 2
- Reaction score
- 0
I want to write a method to determine if a given string is a palindrome. E.g. "Madam I'm Adam", or "A man, a plan, a canal, Panama".
The prototype for the function is:
I have a simple logic to check for equality by moving forward & backward from extreme ends of the string.
But, i would like to know how many efficient ways to do this ? All ideas welcome from C++ gurus..
The prototype for the function is:
Code:
bool is_palindrome(char const * str)
I have a simple logic to check for equality by moving forward & backward from extreme ends of the string.
But, i would like to know how many efficient ways to do this ? All ideas welcome from C++ gurus..