跳到主要内容

Maximal Square

描述

TODO

分析

f(i,j)表示以matrix[i][j]为右下角的正方形的边长,

f(i,j)={0matrix[i][j]=0min{f(i1,j),f(i,j1),f(i1,j1)}+1matrix[i][j]=1f(i,j)=\begin{cases} 0 & matrix[i][j]=0 \\ \min\left\{f(i-1,j), f(i, j-1), f(i-1,j-1)\right\}+1 & matrix[i][j]=1 \end{cases}

代码

# Empty line - nothing to translate since the input contains only a comment
# TODO