Search
⌘K

Leetcode 308. Range Sum Query 2D - Mutable

Design a data structure that supports point updates and returns the sum of any submatrix in a 2D matrix, optimizing for many interleaved update and sumRegion operations. Expect to use a dynamic 2D structure (e.g., 2D BIT or 2D segment tree) to achieve much better than O(mn) per operation — typically logarithmic time per update/query.

Asked at:

M

Moloco


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early October, 2025

M

Moloco

Staff

Follow-up: a. Implement caching for the query method. This method takes the corner coordinates as input. b. Enhance caching to support heavy write. The write is performed in a specific cell( takes row and column as input).

Comments

Your account is free and you can post anonymously if you choose.