Prefix sum array

what is the time complexity to calculate prefix sum for both row and column?

Hey @kani001
It will be O(n*m) because we will be traversing every element once .

We reduced
O(m∗n∗q) to O(m∗n+q) , which means cubic to quadratic, a huge reduction in complexity.