[Java/Python 3] Similar to Matrix Block Sum w/ diagram, analysis and similar problem list..
Note:\n1. ans[r + 1][c + 1] corresponds to cell (r, c); \n2. ans[0][c] and ans[r][0] are all dummy values, which are used for the convenience of computation of 
**Note:**\n1. `ans[r + 1][c + 1]` corresponds to cell `(r, c)`; \n2. `ans[0][c]` and `ans[r][0]` are all dummy values, which are used for the convenience of computation of DP state transmission formula.\n\nTo calculate `ans`, the ideas are as below - credit to @haoel\n```\n+-----+-+-------+     +--------+-----+     +-----+---------+     +-----+--------+\n|     | |       |     |        |     |     |     |         |     |     |        |\n|     | |       |     |        |     |     |     |         |     |     |        |\n+-----+-+       |     +--------+     |     |     |         |     +-----+        |\n|     | |       |  =  |              |  ^  |     |         |  ^  |              | ^ mat[r][c]\n+-----+-+       |     |              |     +-----+         |     |              |\n|               |     |              |     |               |     |              |\n|               |     |              |     |               |     |              |\n+---------------+     +--------------+     +---------------+     +--------------+\n\nans[r+1][c+1] =  ans[r][c+1] ^ ans[r+1][c]    ^   ans[r][c]   ^ mat[r][c]\n```\n\nIf the above is still not clear enough for you, this [website](https://computersciencesource.wordpress.com/2010/09/03/computer-vision-the-integral-image/) explains the concept really well. - credit to **@saidthesky**.\n\n----\n\n```java\n    public int kthLargestValue(int[][] matrix, int k) {\n        PriorityQueue<Integer> pq = new PriorityQueue<>(k + 1);\n        int R = matrix.length, C = matrix[0].length;\n        int[][] ans = new int[R + 1][C + 1];\n        for (int r = 0; r < R; ++r) {\n            for (int c = 0; c < C; ++c) {\n                ans[r + 1][c + 1] = matrix[r][c] ^ ans[r][c + 1] ^ ans[r + 1][c] ^ ans[r][c];\n                pq.offer(ans[r + 1][c + 1]);\n                if (pq.size() > k) {\n                    pq.poll();\n                }\n            }\n        }\n        return pq.poll();\n    }\n```\n```python\n    def kthLargestValue(self, matrix: List[List[int]], k: int) -> int:\n        R, C = map(len, (matrix, matrix[0]))\n        ans = [[0] * (C + 1) for _ in range(R + 1)]\n        heap = []\n        for r, row in enumerate(matrix):\n            for c, cell in enumerate(row):\n                ans[r + 1][c + 1] = cell ^ ans[r + 1][c] ^ ans[r][c + 1] ^ ans[r][c]\n                heapq.heappush(heap, ans[r + 1][c + 1])\n                if len(heap) > k:\n                    heapq.heappop(heap)\n        return heap[0]            \n```\n**Analysis:**\n\nTime: O(R * C * logk), space: O(R * C).\n\n----\n\nIf you need more practice with `range/prefix sum`, please refer to:\n[304. Range Sum Query 2D - Immutable](https://leetcode.com/problems/range-sum-query-2d-immutable)\n[307. Range Sum Query - Mutable](https://leetcode.com/problems/range-sum-query-mutable)\n[308. Range Sum Query 2D - Mutable: Premium](https://leetcode.com/problems/range-sum-query-2d-mutable)\n[1314. Matrix Block Sum](https://leetcode.com/problems/matrix-block-sum/discuss/477036/JavaPython-3-PrefixRange-sum-w-analysis-similar-to-LC-30478)
[]