[Java] O(R*R*C) or O(C*C*R) Solution
Convert it to 1-D array, then the problem turns into "search for subarray sums that equal to the target", which uses hashmap to track prefix sum count during it
* Convert it to 1-D array, then the problem turns into "search for subarray sums that equal to the target", which uses hashmap to track prefix sum count during iteration.\n```\nclass Solution {\n    public int numSubmatrixSumTarget(int[][] matrix, int target) {\n        int res = 0, r = matrix.length, c = matrix[0].length;\n        \n        for (int i = 0; i < c; i++) {\n            int[] rowSums = new int[r];\n            for (int j = i; j < c; j++) {\n                Map<Integer, Integer> count = new HashMap<>();\n                count.put(0, 1);\n                int prefixSum = 0;\n                for (int k = 0; k < r; k++) {\n                    rowSums[k] += matrix[k][j];\n                    prefixSum += rowSums[k];\n                    res += count.getOrDefault(prefixSum - target, 0);\n                    count.put(prefixSum, count.getOrDefault(prefixSum, 0) + 1);\n                }\n            }\n        }\n        \n        return res;\n    }\n}\n```
[]