feat(content): function signatures + test cases

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

View File

@@ -11,6 +11,39 @@ patterns:
- bfs
- matrix-traversal
function_signature: "def max_area_of_island(grid: list[list[int]]) -> int:"
test_cases:
visible:
- input:
grid: [[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]]
expected: 6
- input:
grid: [[0, 0, 0, 0, 0, 0, 0, 0]]
expected: 0
hidden:
- input:
grid: [[1]]
expected: 1
- input:
grid: [[0]]
expected: 0
- input:
grid: [[1, 1], [1, 1]]
expected: 4
- input:
grid: [[1, 0, 1], [0, 0, 0], [1, 0, 1]]
expected: 1
- input:
grid: [[1, 1, 1, 1, 1]]
expected: 5
- input:
grid: [[1], [1], [1], [1]]
expected: 4
- input:
grid: [[1, 0, 0, 1], [1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 0, 1]]
expected: 5
description: |
You are given an `m × n` binary matrix `grid`. An island is a group of `1`s (representing land) connected **4-directionally** (horizontal or vertical). You may assume all four edges of the grid are surrounded by water.