How do you find the number of rectangles in a 2D matrix of 0s and 1s?
(如何在2s为0和1s的矩阵中找到矩形的数目?)
I have searched for it on google , i found answer like link, tried to code like question of upper link , but my question is a little bit different.
(我已经在google上搜索了它,发现了类似链接的答案,试图对上链接的问题进行编码,但是我的问题有点不同。)
I should count rectangle with all linked-0s.
(我应该用所有链接的0来计数矩形。)
So if 2x2 array is only filled with 0s, result should be 0 , not 9 (4 of 1x1, 4 of 1x2, 1 of 2x2) (因此,如果2x2数组仅填充0,则结果应为0,而不是9(1x1中的4、1x2中的4、2x2中的1))
ask by Byeongyoon translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…