Matsushita's Blog

Range Sum Query 2D - Mutable : Past Google Coding Interview


How to Solve

This problem can be solved by using Binary Indexed Tree. Please check below article if you want to know the details of Binary Indexed Tree.

But in this problem case, I use BIT(Binary Indexed Tree) as a 2D because input values is a matrix.

Source Code