easy || beats 97% || java
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public long maxMatrixSum(int[][] matrix) {\n        long maxSum=0;\n        int negCnt=0;\n        int minNegVal=Integer.MAX_VALUE;\n\n        int m=matrix.length;\n        int n=matrix[0].length;\n\n        for(int i=0; i<m; i++){\n            for(int j=0; j<n; j++){\n                int val=Math.abs(matrix[i][j]);\n                minNegVal=Math.min(minNegVal, val);\n                maxSum+=val;                \n                if(matrix[i][j]<0){                   \n                    negCnt++;                    \n                }                \n            }\n        }\n\n\n        if(negCnt%2==0){\n            return maxSum;\n        }\n        else{\n            return maxSum-2*minNegVal;\n        }\n       \n    }\n}\n```
['Java']