代码拉取完成,页面将自动刷新
package Algorithm.dynamic.largestSquare;
/**
* @author 蔚蔚樱
* @version 1.0
* @date 2019-11-05 02:12
* @author—Email micromicrohard@outlook.com
* @description 最大正方形
* 在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积。
* 解法一:暴力法
* 1.1)暴力循环扫描法(含冗余扫描)
* 1.2)逐层扫描法
* 1.3)最大长度限制法
* 解法二:动态规划法
* 解法三:动态规划优化
*/
public interface LargestSquare {
public int Solution(int[][] Matrix);
default boolean check(int[][] Matrix) {
//校验矩阵:空值问题
if (null == Matrix || Matrix.length == 0 || Matrix[0].length == 0) {
return false;
}
//校验矩阵:仅含0,1,否则输出-3
for (int i = 0; i < Matrix.length; i++) {
for (int j = 0; j < Matrix[i].length; j++) {
if (Matrix[i][j] != 0 && Matrix[i][j] != 1) {
return false;
}
}
}
return true;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。