feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,30 @@ categories:
|
||||
patterns:
|
||||
- matrix-traversal
|
||||
|
||||
function_signature: "def island_perimeter(grid: list[list[int]]) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { grid: [[0, 1, 0, 0], [1, 1, 1, 0], [0, 1, 0, 0], [1, 1, 0, 0]] }
|
||||
expected: 16
|
||||
- input: { grid: [[1]] }
|
||||
expected: 4
|
||||
- input: { grid: [[1, 0]] }
|
||||
expected: 4
|
||||
hidden:
|
||||
- input: { grid: [[1, 1]] }
|
||||
expected: 6
|
||||
- input: { grid: [[1], [1]] }
|
||||
expected: 6
|
||||
- input: { grid: [[1, 1], [1, 1]] }
|
||||
expected: 8
|
||||
- input: { grid: [[0, 1, 0], [1, 1, 1], [0, 1, 0]] }
|
||||
expected: 12
|
||||
- input: { grid: [[1, 1, 1, 1, 1]] }
|
||||
expected: 12
|
||||
- input: { grid: [[0, 0, 0], [0, 1, 0], [0, 0, 0]] }
|
||||
expected: 4
|
||||
|
||||
description: |
|
||||
You are given a `row x col` grid representing a map where `grid[i][j] = 1` represents land and `grid[i][j] = 0` represents water.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user