feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent d2b74b6863
commit 85fea3a4bb
94 changed files with 1840 additions and 0 deletions

View File

@@ -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*.