Skip to content

Instantly share code, notes, and snippets.

@dcabines
Created May 9, 2014 16:23
Show Gist options
  • Save dcabines/0c7e55f81d1ca3942e3c to your computer and use it in GitHub Desktop.
Save dcabines/0c7e55f81d1ca3942e3c to your computer and use it in GitHub Desktop.
Know it. Memorize it.
/// <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