public static int[] BuildCharFrequencyTable(String phrase) { int[] table = new int[(int)char.GetNumericValue('z') - (int)char.GetNumericValue('a') + 1]; foreach (char c in phrase.ToCharArray()) { int x = CharExtension.GetCharNumber(c); if (x != -1) { table[x]++; } } return(table); }
public static bool IsPermutationOfPalindrome2(String phrase) { int countOdd = 0; int[] table = new int[(int)char.GetNumericValue('z') - (int)char.GetNumericValue('a') + 1]; foreach (char c in phrase.ToCharArray()) { int x = CharExtension.GetCharNumber(c); if (x != -1) { table[x]++; if (table[x] % 2 == 1) { countOdd++; } else { countOdd--; } } } return(countOdd <= 1); }
public static string r(byte foreColor, byte backColor) { return(ColorSequenceDelim.ToString() + CharExtension.ConvertToHexadecimalPattern(foreColor) + CharExtension.ConvertToHexadecimalPattern(backColor)); }