Module Expr Str Assign NameStore Str ClassDef bases body FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If CompareLt NameLoad Num body Return Num Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num If CompareLt NameLoad Num body Return Num For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore Num Assign NameStore ListComp ListComp Num comprehension NameStore Call NameLoad BinOpAdd NameLoad Num comprehension NameStore Call NameLoad BinOpAdd NameLoad Num Assign NameStore ListComp ListComp Num comprehension NameStore Call NameLoad BinOpAdd NameLoad Num comprehension NameStore Call NameLoad BinOpAdd NameLoad Num Assign NameStore ListComp ListComp Num comprehension NameStore Call NameLoad BinOpAdd NameLoad Num comprehension NameStore Call NameLoad BinOpAdd NameLoad Num For NameStore Call NameLoad Num BinOpAdd NameLoad Num body For NameStore Call NameLoad Num BinOpAdd NameLoad Num body If CompareEq SubscriptLoad SubscriptLoad NameLoad Index BinOpSub NameLoad Num Index BinOpSub NameLoad Num Num body Continue AugAssignAdd SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad BinOpAdd SubscriptLoad SubscriptLoad NameLoad Index BinOpSub NameLoad Num Index NameLoad SubscriptLoad SubscriptLoad NameLoad Index BinOpSub NameLoad Num Index BinOpSub NameLoad Num AugAssignAdd SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad BinOpAdd SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index BinOpSub NameLoad Num SubscriptLoad SubscriptLoad NameLoad Index BinOpSub NameLoad Num Index BinOpSub NameLoad Num Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad Call NameLoad BinOpAdd SubscriptLoad SubscriptLoad NameLoad Index BinOpSub NameLoad Num Index BinOpSub NameLoad Num Num SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad Return BinOpMult NameLoad NameLoad decorator_list decorator_list
N/A N/A 
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.

For example, given the following matrix:

1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4.
 N/A __author__ Daniel Solution N/A N/A maximalSquare N/A N/A self matrix N/A N/A N/A 
        Brute force: O(n^3)
        DP: O(n^2)
        square_width[i][j] = min(
                    square_width[i-1][j-1]+1,
                    to_left[i][j],
                    to_top[i][j],
                )

        :param matrix: matrix
        :return: int
         N/A m N/A len matrix N/A N/A m 1 N/A N/A 0 N/A n N/A len N/A matrix N/A 0 N/A N/A n 1 N/A N/A 0 N/A i N/A xrange m N/A N/A N/A matrix N/A i N/A map int N/A matrix N/A i N/A maxa 0 N/A to_top N/A N/A 0 N/A _ N/A xrange N/A n 1 N/A _ N/A xrange N/A m 1 N/A to_left N/A N/A 0 N/A _ N/A xrange N/A n 1 N/A _ N/A xrange N/A m 1 N/A square_width N/A N/A 0 N/A _ N/A xrange N/A n 1 N/A _ N/A xrange N/A m 1 N/A i N/A xrange 1 N/A m 1 N/A N/A j N/A xrange 1 N/A n 1 N/A N/A N/A N/A N/A matrix N/A N/A i 1 N/A N/A j 1 0 N/A N/A N/A N/A N/A to_top N/A i N/A j N/A N/A N/A to_top N/A N/A i 1 N/A j N/A N/A matrix N/A N/A i 1 N/A N/A j 1 N/A N/A N/A to_left N/A i N/A j N/A N/A N/A to_left N/A i N/A N/A j 1 N/A N/A matrix N/A N/A i 1 N/A N/A j 1 N/A N/A N/A square_width N/A i N/A j N/A min N/A N/A N/A square_width N/A N/A i 1 N/A N/A j 1 1 N/A N/A to_left N/A i N/A j N/A N/A to_top N/A i N/A j N/A maxa N/A max maxa N/A N/A square_width N/A i N/A j N/A N/A maxa maxa N/A N/A