
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The number of blocks is too much but the number of black cells is less than that.
It means the number of blocks with at least one black cell is O(|coordinates|). let’s just hold them.
Iterate through the coordinates and update the block counts accordingly. For each coordinate, determine which block(s) it belongs to and increment the count of black cells for those block(s).
After processing all the coordinates, count the number of blocks with different numbers of black cells. You can use another data structure to keep track of the counts of blocks with 0 black cells, 1 black cell, and so on.