Ejemplo n.º 1
0
        // == == == == == Puzzle 2 == == == == ==
        public static int Puzzle2(string input)
        {
            var ar = new AlchemicalReducer(input);
            int shortestPolymer = input.Length;

            foreach (var unit in "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray())
            {
                var reducedLength = ar.ReduceWithSkip(unit);
                shortestPolymer = shortestPolymer > reducedLength ? reducedLength : shortestPolymer;
            }
            return(shortestPolymer);
        }
Ejemplo n.º 2
0
        // == == == == == Puzzle 1 == == == == ==
        public static int Puzzle1(string input)
        {
            var ar = new AlchemicalReducer(input);

            return(ar.Reduce());
        }