Max sub-array slidey window
This commit is contained in:
@@ -444,3 +444,24 @@ def test_trie_busy():
|
||||
assert trie.startsWith("rent") is True
|
||||
assert trie.startsWith("beer") is True
|
||||
assert trie.startsWith("jam") is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("nums", "expected"),
|
||||
[
|
||||
(
|
||||
[-2, 1, -3, 4, -1, 2, 1, -5, 4],
|
||||
6,
|
||||
),
|
||||
(
|
||||
[1],
|
||||
1,
|
||||
),
|
||||
(
|
||||
[5, 4, -1, 7, 8],
|
||||
23,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_maximum_subarray(nums: list[int], expected: int):
|
||||
assert stuff.sum_max_sub_array(nums) == expected
|
||||
|
||||
Reference in New Issue
Block a user