sir my answer is coming some junk value
Sum of submatrix approch 2
@Megha2468 we are getting garbage because you are indexing the arrays outside their boundries in the for loops where you are doing row +1 and col +1 (when row=n-1, row+1=n out of bound)
sir I corrected it but getting same error
sir please correct my code
@Megha2468 You were doing mistake in calculating the prefix sum matrix, and second thing we need to ensure that we are not accessing negative index when we are finding values of P, Q, R
If this resolves your doubt mark it resolved.