feat(content): more test cases
This commit is contained in:
@@ -11,6 +11,24 @@ patterns:
|
||||
- bfs
|
||||
- matrix-traversal
|
||||
|
||||
function_signature: "def num_islands(grid: list[list[str]]) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { grid: [["1", "1", "1", "1", "0"], ["1", "1", "0", "1", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "0", "0", "0"]] }
|
||||
expected: 1
|
||||
- input: { grid: [["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"]] }
|
||||
expected: 3
|
||||
hidden:
|
||||
- input: { grid: [["1"]] }
|
||||
expected: 1
|
||||
- input: { grid: [["0"]] }
|
||||
expected: 0
|
||||
- input: { grid: [["1", "0", "1", "0", "1"]] }
|
||||
expected: 3
|
||||
- input: { grid: [["1", "1"], ["1", "1"]] }
|
||||
expected: 1
|
||||
|
||||
description: |
|
||||
Given an `m × n` 2D binary grid `grid` which represents a map of `'1'`s (land) and `'0'`s (water), return *the number of islands*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user