F_G

许多问题需要说清楚就可以&&走永远比跑来的重要

导航

[Leetcode] Maximal Square

一、枚举所有宽度为举着宽度的子矩阵,从中找出是否具有相应长度的正方形,复杂度为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

posted on 2015-08-01 14:30  F_G  阅读(128)  评论(0编辑  收藏  举报