How to find maximum xor in a sub matrix?

后端 未结 3 756
没有蜡笔的小新
没有蜡笔的小新 2021-01-17 03:20

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

3条回答
  •  臣服心动
    2021-01-17 04:06

    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.

提交回复
热议问题