QUEUE , BEATS 100%  detailed explanation| Easy implementation
\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& matrix, int k) {\n        priority_queue<int,vector<int>,greater<int> > pq;\n        i
```\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& matrix, int k) {\n        priority_queue<int,vector<int>,greater<int> > pq;\n        int n=matrix.size();\n        int m=matrix[0].size();\n        vector<vector<int>> row(n+1,vector<int> (m+1,0));\n        vector<vector<int>> col(n+1,vector<int> (m+1,0));\n          vector<vector<int>> visited(n+1,vector<int> (m+1,0));\n        \n        for(int i=0;i<n;i++)\n        {\n            int x=0;\n            for(int j=0;j<m;j++)\n            {\n                x=x^matrix[i][j];\n                row[i][j]=x;\n            }\n            \n        }\n      \n        for(int j=0;j<m;j++)\n        {\n            int x=0;\n            for(int i=0;i<n;i++)\n            {\n                x=x^matrix[i][j];\n                col[i][j]=x;\n            }\n            \n            \n            \n            \n        }\n        \n        \n        \n        queue<pair<pair<int,int>,int> > q;\n        q.push({{0,0},matrix[0][0]});\n        visited[0][0]=1;\n        pq.push(matrix[0][0]);\n        \n        \n        while(!q.empty())\n        {\n            pair<int,int> coo=q.front().first;\n\n            int val=q.front().second;\n         \n            q.pop();\n        \n            \n            int valforpqf=-1;\n            int valforpqs=-1;\n          \n                valforpqf=row[coo.first+1][coo.second]^val;\n           \n                valforpqs=col[coo.first][coo.second+1]^val;\n            // cout<<valforpqf<<" "<<valforpqs<<endl;\n            \n            int x=coo.first;\n            int y=coo.second;\n            if(coo.first+1<n && valforpqf!=-1 && ! visited[coo.first+1][coo.second])\n            {\n                \n              visited[coo.first+1][coo.second]=1;\n                q.push({{coo.first+1,coo.second},{valforpqf}});\n                pq.push(valforpqf);\n             \n            }\n            if(coo.second+1<m && valforpqs!=-1 &&  !visited[coo.first][coo.second+1])\n            {\n                 visited[coo.first][coo.second+1]=1;\n                q.push({{coo.first,coo.second+1},{valforpqs}});\n            \n                 pq.push(valforpqs);\n            }\n            \n            while(pq.size()>k)\n            {\n                pq.pop();\n            }\n            \n            \n            \n            \n         \n            \n            \n            \n        }\n       \n        \n        return pq.top();\n        \n    }\n};\n```
[]