Simple python solution with explanation
The Main logic Behind this solution is :\n-> 0^k=k\n-> k^k=0 where k is any value\n\nWe need to Reconstruct the given matrix with each value(i,j) being the XOR 
The Main logic Behind this solution is :\n-> 0^k=k\n-> k^k=0 where k is any value\n\nWe need to Reconstruct the given matrix with each value(i,j) being the XOR of values from 0..i and 0..j\nThink of your logic being seeing the solution.\n\nNow lets start...\nwe know that the first value(0,0) remains the same so, we leave the first value in out matrix as the same\nnow the value of matrix[0][1]=matrix[0][0]^matrix[0][1] and the value of matrix[0][2]=matrix[0][0]^matrix[0][1]^matrix[0][2] and so on...\nhere if we carefully observe the value of matrix[0][2] it is equal to the value of matrix[0][1]^matrix[0][2].\nand therfore the value of marix[0][k]=matrix[0][k-1]^matrix[0][k]\nand similarly for matrix[k][0]\n\n\nnow the problem is for matrix[k1][k2]\nso,let us consider the value of k1=1 and k2=1\nso we need to store matrix[1][1]=matrix[0][0]^matrix[1][0]^matrix[0][1]^matrix[1][1]   (k1 from 0 to 1 and k2 from 0 to 1)\nto do this,we know that value from k1-> 0 to 1 which is stored in matrix[1][0] and k2->0 to 1 and which is stored in matrix[0][1]\nwe know that matrix[1][0] has stored value of matrix[0][0]^matix[1][0] and matrix[0][1] has stored value of matrix[0][0]^matrix[0][1]\nnow if we do matrix[1][0]^matrix[0][1] we get matrix[0][0]^matrix[1][0]^matrix[0][0]^matrix[0][1] which inturn is matrix[1][0]^(matrix[0][0]^matrix[0][0])^matrix[0][1]=matrix[1][0]^matrix[0][1]  (because 0^k=k and k^k=0)\nso now we have matrix[1][0]^matrix[0][1]\nbut we need to have matrix[0][0] also, so our matrix[1][1] becomes matrix[0][1]^matrix[1][0]^matrix[0][0] and XOR with matrix[1][1]\ni.e.. matrix[i][j]=matrix[i-1][j]^matrix[i][j-1]^matrix[i-1][j-1]^matrix[i][j]\n\nthe code for above solution is :\n\n\n\n\n\n```class Solution:\n    def kthLargestValue(self, matrix: List[List[int]], k: int) -> int:\n        l=[]\n        l.append(matrix[0][0])\n        for i in range(1,len(matrix)):\n            matrix[i][0]^=matrix[i-1][0]\n            l.append(matrix[i][0])\n        for j in range(1,len(matrix[0])):\n            matrix[0][j]^=matrix[0][j-1]\n            l.append(matrix[0][j])\n        for i in range(1,len(matrix)):\n            for j in range(1,len(matrix[0])):\n                matrix[i][j]^=matrix[i-1][j]^matrix[i][j-1]^matrix[i-1][j-1]\n                l.append(matrix[i][j])\n        l.sort()\n        return l[-k]\n```\n\nupvote if you like it :)
[]