Пример #1
0
        public int SolvePart2()
        {
            var buffer = new DepthBuffer();

            buffer.Push(GetNextDepthValue());
            buffer.Push(GetNextDepthValue());
            buffer.Push(GetNextDepthValue());

            var previousWindowSum = buffer.Sum();

            while (!buffer.Stop())
            {
                if (buffer.Sum() > previousWindowSum)
                {
                    _WindowSumIncreaseCount++;
                }

                previousWindowSum = buffer.Sum();

                buffer.Push(GetNextDepthValue());
            }

            return(_WindowSumIncreaseCount);
        }