Similar to "Subarray with target k"
\nclass Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {\n        \n        int ro=matrix.size(),co=matrix[0].size(
```\nclass Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {\n        \n        int ro=matrix.size(),co=matrix[0].size();\n        \n        if(ro<1)\n            return 0;\n        //prefix sum \n        for(int r=0;r<ro;r++)\n            for(int c=1;c<co;c++)\n                matrix[r][c]+=matrix[r][c-1];\n        \n        int count=0;\n        for(int c1=0;c1<co;c1++)\n        for(int c2=c1;c2<co;c2++)\n        {\n            //appling "subarray with sum k" between the c1 and c2 || no of element is no of rows  \n            unordered_map<int,int>mp;\n            int sum=0;\n            mp[0]=1;\n            for(int r=0;r<ro;r++)\n            {\n                sum+=matrix[r][c2]-(c1>0?matrix[r][c1-1]:0);// sum of row between c1 and c2;\n                    int find=sum-target;          \n                if(mp.find(find)!=mp.end())\n                    count+=mp[find];\n                mp[sum]++;\n            }\n        }\n        return count++;\n        \n        \n    }\n};\n```
['Matrix', 'Prefix Sum']