[JS] Accumulated (prefix) XOR and sort
You could step by step:\n- accumulate left to right: current ^ left\n- accumulate up to bottom: current ^ up\n\nOr  do this in one go: current ^ left ^ up ^ upl
You could step by step:\n- accumulate left to right: `current ^ left`\n- accumulate up to bottom: `current ^ up`\n\nOr  do this in one go: `current ^ left ^ up ^ upleft`\n\nAfter that, things get easier, just by sort the flattened array and get the k-th element\n\n```\nvar kthLargestValue = function (matrix, k) {\n  let m = matrix[0].length;\n  let n = matrix.length;\n\n  for (let i = 0; i < n; i++) {\n    for (let j = 0; j < m; j++) {\n      const up = i - 1 < 0 ? 0 : matrix[i - 1][j];\n      const left = j - 1 < 0 ? 0 : matrix[i][j - 1];\n      const upleft = j - 1 < 0 || i - 1 < 0 ? 0 : matrix[i - 1][j - 1];\n      matrix[i][j] ^= up ^ left ^ upleft;\n    }\n  }\n\n  return matrix.flat().sort((a, b) => b - a)[k - 1];\n};\n```
[]