Data Structures19 sections · 729 units
Open in Course

Problem - Range Sum Query 2D Mutable

2D BIT application

Given a 2D matrix, implement:

  • update(row, col, val): Update matrix[row][col] to val
  • sumRegion(row1, col1, row2, col2): Return sum of rectangle You're solving the same problem from segment trees, but 2D BIT is simpler to implement. Constraints: matrix up to 200×200200 \times 200, up to 10410^4 operations.