Time Complexity -  O(N*M*log(K))
\n# Complexity\n- Time complexity: O(NMlog(K)) \n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(N*M)\n Add your space complexity here, e.g.
\n# Complexity\n- Time complexity: O(N*M*log(K)) \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N*M)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int kthLargestValue(int[][] matrix, int k) {\n        PriorityQueue<Integer> maxheap = new PriorityQueue<>();\n        int n= matrix.length,m =matrix[0].length;\n        int xor[][] =new int[n][m];\n\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                int topCorner = i-1<0 || j-1<0 ?0:xor[i-1][j-1];\n                int up = i-1<0?0:xor[i-1][j];\n                int left = j-1<0?0:xor[i][j-1];\n\n                xor[i][j] = matrix[i][j] ^ topCorner ^ up ^ left;\n                maxheap.add(xor[i][j]);\n                if(maxheap.size()>k)    maxheap.remove();\n            }\n        }\n\n\n        \n        return maxheap.poll();\n        \n        \n    }\n}\n```
['Java']