Easy to understand, 0(m*n) time complexity
Approach\nIf even number of negative numbers, the array can be manipulated in a way to make all of them positive. If odd number of negative numbers, we can make
# Approach\nIf even number of negative numbers, the array can be manipulated in a way to make all of them positive. If odd number of negative numbers, we can make the minimum number as negative.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(m*n)\n\n- Space complexity:O(1)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    long long maxMatrixSum(vector<vector<int>>& matrix) {\n        int n = matrix.size();\n        int m = matrix[0].size();\n        bool negs = 0;\n        long long ans = 0;\n        int minNum = abs(matrix[0][0]);\n        for(int i = 0;i<n;i++) {\n            for(int j = 0;j<m;j++) {\n                if(matrix[i][j] < 0) {\n                    negs = !negs;\n                }\n                ans += abs(1LL*matrix[i][j]);\n                minNum = min(minNum, abs(matrix[i][j]));\n            }\n        }\n        if(!negs) return ans;\n        return ans - 2*minNum;\n    }\n};\n```
['C++']