missing test case


  • 3
    L

    ["00000","10000","00000","00000"]

    Only '1' existed in column 0

    The code below will AC but missing the test case above

    class Solution(object):
        def maximalSquare(self, matrix):
            """
            :type matrix: List[List[str]]
            :rtype: int
            """
            if not matrix: return 0
            dp = [[0 for j in xrange(len(matrix[0]))] for i in xrange(len(matrix))]
            max_value = 0
            for j in xrange(len(matrix[0])):
                dp[0][j] = int(matrix[0][j])
                max_value = max(dp[0][j], max_value)
            for i in xrange(1, len(matrix)):
                dp[i][0] = int(matrix[i][0])
                for j in xrange(1, len(matrix[0])):
                    if matrix[i][j] == '1':
                        dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1
                        max_value = max(dp[i][j], max_value)
                    
            return max_value * max_value
    

  • 0

    @li.mian.353 Thanks, test case just added.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.