C++ Simple, Short and Easy Solution. With Explanation
Idea:\nIf we have an even amount of negative numbers, we can always swap two adjacent elements two make two negative numbers adjacent and make both positive. So
**Idea:**\nIf we have an even amount of negative numbers, we can always swap two adjacent elements two make two negative numbers adjacent and make both positive. So in such a case our result will be the sum of all absolute values of the matrix.\nIf the amount of negative values is odd, then we can do the same until we are left with one negative number and also make that last number be the minimum. So our result is the sum of all absolute values of the matrix minus the minimum absolute value * 2. (To make it negative, we have to subtract one time to make 0 and another to make minus).\n```\nclass Solution {\npublic:\n    long long maxMatrixSum(vector<vector<int>>& matrix) {\n        long long count = 0, mini = INT_MAX, sum_abs = 0;\n        for (int i = 0; i < matrix.size(); i++) {\n            for (int j = 0; j < matrix[0].size(); j++) {\n                if (matrix[i][j] < 0) {\n                    count++;\n                }\n                mini = min(mini, (long long)abs(matrix[i][j]));\n                sum_abs += abs(matrix[i][j]);\n            }\n        }\n        sum_abs -= count % 2 ? 2 * mini : 0;\n        return sum_abs;\n    }\n};\n```\n**Like it? please upvote!**
['C']