コード例 #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);
 }
コード例 #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);
            }
コード例 #3
0
ファイル: Col.cs プロジェクト: mvaganov/20210131_ggj2021
 public static string r(byte foreColor, byte backColor)
 {
     return(ColorSequenceDelim.ToString() +
            CharExtension.ConvertToHexadecimalPattern(foreColor) +
            CharExtension.ConvertToHexadecimalPattern(backColor));
 }