C++ | DP | Faster than 100% | Prefix XOR
2d DP with prefix XOR type approach\n\n* The tricky part is to include XOR of v[i-1][j-1] as we have included value till there twice and if we XOR it again the 
**2d DP with prefix XOR type approach**\n\n* The tricky part is to include XOR of v[i-1][j-1] as we have included value till there twice and if we XOR it again the values gets cancelled.\n\n\n```\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& v, int k) {\n        int n=v.size();\n        int m=v[0].size();\n        vector<int>ans(n*m);\n        ans.clear();\n        for(int i=0;i<n;i++)\n        {\n            for(int j=0;j<m;j++)\n            {\n                if(j==0 && i==0);\n                else if(j==0)\n                    v[i][j]=v[i][j]^v[i-1][j];\n                else if(i==0)\n                v[i][j]=v[i][j]^v[i][j-1];\n                else\n                    v[i][j]=v[i][j]^(v[i-1][j]^v[i][j-1]^v[i-1][j-1]);\n                ans.push_back(v[i][j]);\n            }\n            //cout<<endl;\n        }\n        sort(ans.begin(),ans.end(),greater<int>());\n        \n       \n        return ans[k-1];\n    }\n};\n```
[]