C++||Hashmap||Easy & Understandable
\nclass Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& A, int target) {\n        int res = 0, m = A.size(), n = A[0].size();\n\t\tfor (
```\nclass Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& A, int target) {\n        int res = 0, m = A.size(), n = A[0].size();\n\t\tfor (int i = 0; i < m; i++)\n\t\t\tfor (int j = 1; j < n; j++)\n\t\t\t\tA[i][j] += A[i][j - 1];\n\n\t\tunordered_map<int, int> counter;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = i; j < n; j++) {\n\t\t\t\tcounter = {{0,1}};\n\t\t\t\tint cur = 0;\n\t\t\t\tfor (int k = 0; k < m; k++) {\n\t\t\t\t  cur += A[k][j] - (i > 0 ? A[k][i - 1] : 0);\n\t\t\t\t  res += counter.find(cur - target) != counter.end() ? counter[cur - target] : 0;\n\t\t\t\t  counter[cur]++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn res;\n    }\n};\n```
['C']