Question DSA-ARR-0078
HardIn a 2D prefix-sum matrix P, how is the sum of the rectangle from (r1, c1) to (r2, c2) computed?
- A.
P[r2][c2] + P[r1][c1]
- B.
P[r2][c2] − P[r1−1][c2] − P[r2][c1−1] + P[r1−1][c1−1]
- C.
Sign up free to see the answer and a step-by-step explanation.