2D Range Sum Query (Immutable)

Given an m x n integer matrix and q queries, each query gives the top-left corner (r1, c1) and bottom-right corner (r2, c2) (0-indexed, inclusive). Return the sum of all elements in that submatrix. Ea...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: