eg given 3 x 3 matrix
1 2 3 4 5 6 7 8 9
has max xor value = 15 sub matrix
2 5 8
tha
You can use https://en.wikipedia.org/wiki/Fenwick_tree for fast xor calculation and updates. Segment tree is another structure that can be used. It has similar characteristics but uses more memory. Both can be used for 1D array case as well.