LC: 308. Range Sum Query 2D Mutable - spiralgo/algorithms GitHub Wiki
308. Range Sum Query 2D - Mutable:
The Essence:
We have some implementations in the corresponding PR.
The essence of all these solutions is "modularization" (and our container idea) indeed.
We divide the array into multiple segments to prevent the states of the other segments being affected just because an independent part is updated.
Details:
- We can use
Segment Treesapproach. - We can use
Binary Indexed Tree (Fenwick Tree)approach, as well.
You can find the detailed information here: https://github.com/spiralgo/algorithms/pull/392