Exemplo n.º 1
0
        public int Solution(string input)
        {
            bool[,] lightsGrid = initialLightsConfigurationRepository.ParseInput(input);
            int lightsTurnedOn = this.lightsGrid.CalculateLightsOnAfterAnimation(lightsGrid);

            return(lightsTurnedOn);
        }
Exemplo n.º 2
0
        public int Solution(string input)
        {
            bool[,] lightsGrid = initialLightsConfigurationRepository.ParseInput(input);

            int rows    = lightsGrid.GetLength(0);
            int columns = lightsGrid.GetLength(1);

            // Corners lights are stuck on
            lightsGrid[0, 0]                  = true;
            lightsGrid[0, columns - 1]        = true;
            lightsGrid[rows - 1, 0]           = true;
            lightsGrid[rows - 1, columns - 1] = true;

            int lightsTurnedOn = this.lightsGrid.CalculateLightsOnAfterAnimation(lightsGrid, true);

            return(lightsTurnedOn);
        }