Counting Rectangles of 1's in a Binary Grid

Revision en1, by MinhBoss13, 2024-08-22 06:50:07

Hi everyone! I have an interesting problem for which I haven't devised a solution yet. Can you help me?

Problem Statement:

Imagine you have a 2D grid (with dimensions m×n), where each cell in the grid can either be 0 or 1. Your task is to count the number of rectangles (or submatrices) that are made entirely of 1's.

Constraint: mxn <= 1e6

Thanks for taking the time to read and help me!

Tags grid, counting, binary

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English MinhBoss13 2024-08-22 06:50:07 465 Initial revision (published)