Exemplo n.º 1
0
def test_2():
    sol = Solution()
    m = n = 50
    for _ in xrange(5):
        matrix = np.random.randint(-100, 100, (m, n)).tolist()
        k = np.random.randint(-400, 400)
        assert sol.maxSumSubmatrix(matrix, k) == maxSumSubmatrix(matrix, k)
Exemplo n.º 2
0
def test_4():
    sol = Solution()
    matrix = [[5, -4, -3, 4], [-3, -4, 4, 5], [5, 1, 5, -4]]
    assert maxSumSubmatrix(matrix, 3) == 2
    assert sol.maxSumSubmatrix(matrix, 3) == 2
Exemplo n.º 3
0
def test_3():
    sol = Solution()
    matrix = [[2, 2, -1]]
    assert maxSumSubmatrix(matrix, 0) == -1
    assert sol.maxSumSubmatrix(matrix, 0) == -1
Exemplo n.º 4
0
def test_1():
    sol = Solution()
    matrix = [[1, 0, 1], [0, -2, 3]]
    assert sol.maxSumSubmatrix(matrix, 2) == 2
Exemplo n.º 5
0
def test_0():
    sol = Solution()
    assert sol.maxSumSubmatrix([], 10) == 0
    assert sol.maxSumSubmatrix([[]], 10) == 0