To fill dp [ , ] for finding largest sub matrix with all elements 0
for ( int i = 0 ; i < col ; i ++ ) { int cnt = 0 ; for ( int j = row - 1 ; j >= 0 ; j -- ) { dp [ j , i ] = 0 ; if ( a [ j , i ] == 0 ) { cnt ++ ; dp [ j , i ] = cnt ; } else { cnt = 0 ; } } } for ( int i = 0 ; i < row ; i ++ ) {