示例#1
0
        /// <summary>
        /// Check for the two product numbers that only differs in one char and return the number without these char.
        /// </summary>
        /// <returns>The product number without the diffing char or an empty string if nothing was found.</returns>
        /// <param name="numbers">A List of product numbers.</param>
        public string Part2(string[] numbers)
        {
            foreach (string numberOne in numbers)
            {
                foreach (string numberTwo in numbers)
                {
                    int pos = PartNumber.DiffOnOnePosition(numberOne, numberTwo);

                    if (pos != -1)
                    {
                        return(PartNumber.RemoveChar(numberOne, pos));
                    }
                }
            }

            return(string.Empty);
        }