Python Simple Intuitive Solution
\nfrom collections import defaultdict\nclass Solution(object):\n    def numSubmatrixSumTarget(self, matrix, target):\n        """\n        :type matrix: List[Li
```\nfrom collections import defaultdict\nclass Solution(object):\n    def numSubmatrixSumTarget(self, matrix, target):\n        """\n        :type matrix: List[List[int]]\n        :type target: int\n        :rtype: int\n        """\n        res = 0\n        row,col = len(matrix),len(matrix[0])\n        for k in xrange(row):\n            nums = [0 for _ in xrange(col)]\n            for i in xrange(k,row):\n                for j in xrange(col):\n                    nums[j] += matrix[i][j]\n                res += self.check(nums,target)\n        return res\n    \n    def check(self,nums,target):\n        counter,res = defaultdict(int),0\n        counter[0],cum_sum = 1,0\n        for i,num in enumerate(nums):\n            cum_sum += num\n            res += counter[cum_sum - target]\n            counter[cum_sum] += 1\n        return res\n```
[]