Maximal-Square

Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.

For example, given the following matrix:

Return 4.

size[i][j] = min(size[i-1][j-1],size[i][j-1],size[i-1][j])+1 if matrix[i][j] == '1'
size[i][j] = 0 if matrix[i][j] == '0'

size[i][j] = (matrix[i][j] == '1') where i == 0 or j == 0