Exemplo n.º 1
0
        /// <inheritdoc/>
        public override object PartA()
        {
            var list  = DataAsInts.ToList();
            var pairs = list.Zip(list.Skip(1), Tuple.Create);

            return(pairs.Count(p => p.Item1 < p.Item2));
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public override object PartB()
        {
            const int windowSize = 3;

            var windows = DataAsInts.ToList().Window(windowSize).Select(w => w.Sum()).ToList();
            var pairs   = windows.Zip(windows.Skip(1), Tuple.Create);

            return(pairs.Count(p => p.Item1 < p.Item2));
        }