예제 #1
0
        public string ResolvePart2(string[] inputs)
        {
            IntStream         values      = new IntStream(inputs[0]);
            ChronoLicenceNode licenceTree = ChronoLicenceNode.BuildFromIntStream(values);
            int result = licenceTree.GetValue();

            return(result.ToString());
        }
예제 #2
0
        public static ChronoLicenceNode BuildFromIntStream(IntStream stream)
        {
            ChronoLicenceNode node = new ChronoLicenceNode();
            int numChilds          = stream.Get();
            int numMetadata        = stream.Get();

            for (int i = 0; i < numChilds; i++)
            {
                ChronoLicenceNode childNode = BuildFromIntStream(stream);
                node.Childs.Add(childNode);
            }

            for (int i = 0; i < numMetadata; i++)
            {
                node.Metadata.Add(stream.Get());
            }

            return(node);
        }