Beispiel #1
0
        /// <summary>
        /// Process the product of the count of product numbers that contains a letter 3 times and the count of product numbers that contains
        /// a letter 2 times.
        /// </summary>
        /// <returns>The product of the two counts.</returns>
        /// <param name="numbers">The list of product numbers.</param>
        public int Part1(string[] numbers)
        {
            int two   = 0;
            int three = 0;

            foreach (string number in numbers)
            {
                PartNumber.Checks check = PartNumber.Checksum(number);

                if (PartNumber.HasLetterTwice(check))
                {
                    two++;
                }

                if (PartNumber.HasLetterThreeTimes(check))
                {
                    three++;
                }
            }

            return(two * three);
        }