Title: Maximum Matrix Sum After Negation beats 62% memory &&  O(n^2) time
Intuition\nTo maximize the sum of all elements in a matrix, the strategy revolves around controlling the effect of negative numbers. Converting negative numbers
# Intuition\nTo maximize the sum of all elements in a matrix, the strategy revolves around controlling the effect of negative numbers. Converting negative numbers to positive adds their absolute values to the total sum. However, if there is an odd count of negative numbers, one number will remain negative, resulting in a reduced sum.\n\n# Approach\n1. Calculate the Total Sum:\n    -   Add the absolute values of all elements to the sum. This assumes all elements are treated as positive.\n\n2. Track Negatives:\nCount the total number of negative elements.\n\n    -   If the count of negative numbers is even, all can be effectively "neutralized," yielding the maximum sum.\n    -   If the count is odd, one number must remain negative.\n3. Find the Minimum Absolute Value:\n    -   Identify the smallest absolute value in the matrix. This is used to minimize the penalty if one number must remain negative.\n\n4. Adjust the Sum:\n    -   If there are an odd number of negative numbers, subtract twice the smallest absolute value from the total sum\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n*n)$$\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$\n# Code\n```java []\nclass Solution {\n    public long maxMatrixSum(int[][] matrix) {\n        long sum = 0;         // Total sum of absolute values\n        int cnt = 0;          // Count of negative numbers\n        int min = Integer.MAX_VALUE; // Minimum absolute value\n\n        // Traverse the matrix\n        for (int i = 0; i < matrix.length; i++) {\n            for (int j = 0; j < matrix[0].length; j++) {\n                // Add absolute value to the sum\n                sum += Math.abs(matrix[i][j]);\n                \n                // Count negative numbers\n                if (matrix[i][j] < 0) {\n                    cnt++;\n                }\n\n                // Track the smallest absolute value\n                min = Math.min(min, Math.abs(matrix[i][j]));\n            }\n        }\n\n        // If odd negatives, subtract twice the smallest absolute value\n        if (cnt % 2 == 1) {\n            sum -= 2 * min;\n        }\n\n        return sum;\n    }\n}\n\n```
['Array', 'Greedy', 'Matrix', 'Java']