• + 0 comments

    for C# my solution, if there is any improvements on this please do tell

    public static int flippingMatrix(List<List<int>> matrix)
    {
        int sum = 0;
    
        for (int i = 0, len = matrix.Count - 1; i < (matrix.Count / 2); i++, len--)
        {
            for (int j = 0, k = matrix.Count - 1; j < (matrix.Count / 2); j++, k--)
            {
                int[] temp = [matrix[i][j], matrix[i][k], matrix[len][j], matrix[len][k]];
                sum += temp.Max();
            }
        }
        return sum;
    }