LeetCode – Range Sum Query 2D – Immutable (Java)

Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). Analysis Since the assumption is that there are many calls to sumRegion method, we should use some extra space to store the intermediate results. The solution is … Read more