Created
May 9, 2014 16:23
-
-
Save dcabines/0c7e55f81d1ca3942e3c to your computer and use it in GitHub Desktop.
Know it. Memorize it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Determines whether the string is a palindrome. | |
/// </summary> | |
public static bool IsPalindrome(string value) { | |
int min = 0; | |
int max = value.Length - 1; | |
while (true) { | |
if (min > max) { | |
return true; | |
} | |
char a = value[min]; | |
char b = value[max]; | |
if (char.ToLower(a) != char.ToLower(b)) { | |
return false; | |
} | |
min++; | |
max--; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment