dsa1 min read
Range Sum Query 2D Immutable — 2D Prefix Sum
Sum of rectangle region. Precompute 2D prefix sums: prefix[i][j] = sum of all cells from (0,0) to (i-1,j-1). Inclusion-exclusion for query.
Read →
webcoderspeed.com
1 articles
Sum of rectangle region. Precompute 2D prefix sums: prefix[i][j] = sum of all cells from (0,0) to (i-1,j-1). Inclusion-exclusion for query.