feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,26 @@ patterns:
|
||||
- bfs
|
||||
- matrix-traversal
|
||||
|
||||
function_signature: "def max_distance(grid: list[list[int]]) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { grid: [[1, 0, 1], [0, 0, 0], [1, 0, 1]] }
|
||||
expected: 2
|
||||
- input: { grid: [[1, 0, 0], [0, 0, 0], [0, 0, 0]] }
|
||||
expected: 4
|
||||
hidden:
|
||||
- input: { grid: [[1, 1, 1], [1, 1, 1], [1, 1, 1]] }
|
||||
expected: -1
|
||||
- input: { grid: [[0, 0, 0], [0, 0, 0], [0, 0, 0]] }
|
||||
expected: -1
|
||||
- input: { grid: [[1, 0], [0, 0]] }
|
||||
expected: 2
|
||||
- input: { grid: [[0, 0, 0], [0, 1, 0], [0, 0, 0]] }
|
||||
expected: 2
|
||||
- input: { grid: [[1, 1], [1, 0]] }
|
||||
expected: 1
|
||||
|
||||
description: |
|
||||
Given an `n x n` `grid` containing only values `0` and `1`, where `0` represents water and `1` represents land, find a water cell such that its distance to the nearest land cell is maximized, and return the distance.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user