feat(content): function signatures + test cases

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

View File

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