Redian新闻
>
Maximal Rectangle如果不要求是Rectangle就要简单得多
avatar
Maximal Rectangle如果不要求是Rectangle就要简单得多# JobHunting - 待字闺中
a*e
1
抱怨一下,开始按算面积的想,后来发现题没理解对。有人面试碰到这种题吗?感觉不
像DP
avatar
k*p
2
如果是square就可以DP
avatar
b*i
3
请问你指的是这个吗?
http://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1
1) Construct a sum matrix S[R][C] for the given M[R][C].
a) Copy first row and first columns as it is from M[][] to S[][]
b) For other entries, use following expressions to construct S[][]
If M[i][j] is 1 then
S[i][j] = min(S[i][j-1], S[i-1][j], S[i-1][j-1]) + 1
Else /*If M[i][j] is 0*/
S[i][j] = 0
2) Find the maximum entry in S[R][C]
3) Using the value and coordinates of maximum entry in S[i], print
sub-matrix of M[][]
1-b)看不懂啊,为什么是这三个里面最小的?

【在 k****p 的大作中提到】
: 如果是square就可以DP
avatar
b*i
4
哦,画了个图,想通了。

【在 b******i 的大作中提到】
: 请问你指的是这个吗?
: http://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1
: 1) Construct a sum matrix S[R][C] for the given M[R][C].
: a) Copy first row and first columns as it is from M[][] to S[][]
: b) For other entries, use following expressions to construct S[][]
: If M[i][j] is 1 then
: S[i][j] = min(S[i][j-1], S[i-1][j], S[i-1][j-1]) + 1
: Else /*If M[i][j] is 0*/
: S[i][j] = 0
: 2) Find the maximum entry in S[R][C]

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。