Simple solution using the idea of prefix sum
\njava []\nclass Solution {\n    public int kthLargestValue(int[][] matrix, int k) {\n      int[]r=new int[matrix.length];\n      int[]c=new int[matrix[0].lengt
\n```java []\nclass Solution {\n    public int kthLargestValue(int[][] matrix, int k) {\n      int[]r=new int[matrix.length];\n      int[]c=new int[matrix[0].length];\n      int[][]x=new int[r.length][c.length];\n      PriorityQueue<Integer>pq=new PriorityQueue<>((a,b)->b-a);\n        int ans=0;\n        x[0][0]=matrix[0][0];\n        pq.offer(x[0][0]);\n        for(int i=1;i<matrix.length;i++){\n            x[i][0]=matrix[i][0]^x[i-1][0];\n            pq.offer(x[i][0]);\n           //  System.out.println(pq+" "+i+" "+0);\n        }\n     //  System.out.println(10^9^5);\n        for(int i=1;i<matrix[0].length;i++){\n            x[0][i]=matrix[0][i]^x[0][i-1];\n            pq.offer(x[0][i]);\n        //   System.out.println(pq+" "+0+" "+i);\n        }\n      for(int i=1;i<matrix.length;i++){\n    //   ans^=matrix[i][0];\n    \n       int pp=0;\n     //  pq.offer(ans);\n      //   System.out.println(pq+" "+i+" "+0);\n        for(int j=1;j<matrix[0].length;j++){\n        x[i][j]=x[i-1][j]^x[i][j-1]^matrix[i][j]^x[i-1][j-1];\n         pq.offer(x[i][j]);\n   //  System.out.println(pq+" "+i+" "+j);\n    //    r[i]=ans;\n    \n\n      }\n     \n      }\n    // System.out.println(pq);\n      \n       PriorityQueue<Integer>pq1=new PriorityQueue<>((a,b)->b-a);\n      int l=1;\n      while(pq.size()>0){\n         if(l==k)return pq.peek();\n        pq.poll();\n        l++;\n       \n      }\n      return -1;\n    }\n   // return -1;\n}\n```
['Java']