给定一个01方阵mat及方阵的边长n,该方阵每个单元非0及1,请设计一个高效的算法,返回四条边颜色相同的最大子方阵的边长。保证母方阵边长小于等于100。 测试样例: [[1,1,1],[1,0,1],[1,1,1]],3 返回:3
加载中...
import java.util.*; public class SubMatrix { public int maxSubMatrix(int[][] mat, int n) { // write code here } }
class SubMatrix { public: int maxSubMatrix(vector
> mat, int n) { // write code here } };
# -*- coding:utf-8 -*- class SubMatrix: def maxSubMatrix(self, mat, n): # write code here
class SubMatrix { public int maxSubMatrix(int[][] mat, int n) { // write code here } }