Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
 public static string r(byte foreColor, byte backColor)
 {
     return(ColorSequenceDelim.ToString() +
            CharExtension.ConvertToHexadecimalPattern(foreColor) +
            CharExtension.ConvertToHexadecimalPattern(backColor));
 }