feat(content): function signatures + test cases
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user