1738. Find Kth Largest XOR Coordinate Value.cpp
Code\n\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& matrix, int k) {\n        int i, j, r = matrix.size(), c = matrix[0].size();\n  
**Code**\n```\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& matrix, int k) {\n        int i, j, r = matrix.size(), c = matrix[0].size();\n        for(j=0;j<c;j++)\n            for(i=1;i<r;i++)\n                matrix[i][j] = matrix[i][j] xor matrix[i-1][j];\n        multiset<int> val;\n        for(i=0;i<r;i++){\n            for(j=0;j<c;j++){\n                if(j>0)\n                    matrix[i][j] = matrix[i][j] xor matrix[i][j-1]; \n                if(val.size()==k){ \n                    auto it = val.begin();\n                    if(*it <= matrix[i][j]){\n                        val.erase(it);\n                        val.insert(matrix[i][j]);\n                    }\n                }\n                else\n                    val.insert(matrix[i][j]);\n            }\n        }        \n        auto it = val.begin(); \n        return *it;\n    }\n};\n```
['C']