码迷,mamicode.com
首页 > 其他好文 > 详细

[Leetcode] Maximal Square

时间:2015-08-01 15:40:02      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:

一、枚举所有宽度为举着宽度的子矩阵,从中找出是否具有相应长度的正方形,复杂度为O(n^3);
二、[1]中使用动态规划,decrease the complexity to O(n^2)
dp[i][j] mean the maximum square which has right-down corner (i,j)
the transform function is listed as below:
dp[i][j] = min(dp[i-1][j],dp[i][j-1],dp[i-1][j])+1;
 

[1] http://www.cnblogs.com/easonliu/p/4548769.html

[Leetcode] Maximal Square

标签:

原文地址:http://www.cnblogs.com/deepblueme/p/4694064.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!