End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
count with dimensions equal to the number of columns in the grid, initialized to 0.total to 0 to keep track of the total number of rectangles.i and j), do the following:
i. Add count[i][j] to total because each previous occurrence of this pair means a new rectangle can be formed.
ii. Increment count[i][j] to indicate that we have found another occurrence of this pair.total.