feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent d65ccf7dc2
commit 0262ca8bf6
203 changed files with 4526 additions and 0 deletions

View File

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