C++ Easy Solution Without Hashmap || Prefix Sum || Easy Understanding
C++ Easy Solution Without Hashmap || Prefix Sum || Easy Understanding\n\nclass Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& matrix, i
# **C++ Easy Solution Without Hashmap || Prefix Sum || Easy Understanding**\n```\nclass Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {\n        int n=matrix.size(),m=matrix[0].size(),count=0;\n        vector<vector<int>>temp(n+1,vector<int>(m));\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                temp[i+1][j]=temp[i][j]+matrix[i][j];\n            }\n        }\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<=n;j++){\n                for(int k=0;k<m;k++){\n                    int sum=0;\n                    for(int l=k;l<m;l++){\n                        sum+=temp[j][l]-temp[i][l];\n                        if(sum==target){\n                            // cout<<j<<" "<<i<<" "<<k<<endl;\n                            count++;\n                        }\n                    }\n                }\n            }\n        }\n        return count;\n    }\n};\n```\n# **Please Share and Upvote**
['C', 'Prefix Sum', 'C++']