private static SunMatrixInfo FindMaxSunMatrixWithSize(int[,] matrix, int height, int width, int subMatrixHeight, int subMatrixWidth)
        {
            SunMatrixInfo answer = new SunMatrixInfo
            {
                SumElements = int.MinValue,
                Height      = subMatrixHeight,
                Width       = subMatrixWidth
            };

            for (int i = 0; i <= height - subMatrixHeight; i++)
            {
                for (int j = 0; j <= width - subMatrixWidth; j++)
                {
                    var sum = CalcSubmatrixSum(matrix, i, j, subMatrixHeight, subMatrixWidth);

                    if (sum > answer.SumElements)
                    {
                        answer.SumElements  = sum;
                        answer.TopPosition  = i;
                        answer.LeftPosition = j;
                    }
                }
            }

            return(answer);
        }
        private static SunMatrixInfo FindMaxSunMatrixFromRange(int[,] matrix, int height, int width, int minHeight, int maxHeight, int minWidth, int maxWidth)
        {
            SunMatrixInfo answer = new SunMatrixInfo
            {
                SumElements = int.MinValue
            };

            for (int i = minHeight; i <= maxHeight; i++)
            {
                for (int j = minWidth; j <= maxWidth; j++)
                {
                    var result = FindMaxSunMatrixWithSize(matrix, height, width, i, j);

                    if (result.SumElements > answer.SumElements)
                    {
                        answer = result;
                    }
                }
            }

            return(answer);
        }