c++ | dp | priority_queue | single traversal
\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& mat, int k) {\n        priority_queue<int,vector<int>,greater<>>pq;\n        pq.push(m
```\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& mat, int k) {\n        priority_queue<int,vector<int>,greater<>>pq;\n        pq.push(mat[0][0]);\n        for(int i=0;i<mat.size();i++){\n            for(int j=0;j<mat[0].size();j++){\n                if(i==0 && j==0) continue;\n                if(i==0)mat[i][j]^=mat[i][j-1];\n                else if(j==0)mat[i][j]^=mat[i-1][j];\n                else mat[i][j]^=mat[i-1][j]^mat[i][j-1]^mat[i-1][j-1];\n                pq.push(mat[i][j]);\n                if(pq.size()>k)pq.pop();\n            }\n        }\n        return pq.top();\n    }\n};\n```
['Dynamic Programming', 'C', 'Heap (Priority Queue)']