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,26 @@ patterns:
- matrix-traversal
- dynamic-programming
function_signature: "def update_matrix(mat: list[list[int]]) -> list[list[int]]:"
test_cases:
visible:
- input: { mat: [[0, 0, 0], [0, 1, 0], [0, 0, 0]] }
expected: [[0, 0, 0], [0, 1, 0], [0, 0, 0]]
- input: { mat: [[0, 0, 0], [0, 1, 0], [1, 1, 1]] }
expected: [[0, 0, 0], [0, 1, 0], [1, 2, 1]]
hidden:
- input: { mat: [[0]] }
expected: [[0]]
- input: { mat: [[1, 0, 1], [1, 1, 1], [1, 1, 1]] }
expected: [[1, 0, 1], [2, 1, 2], [3, 2, 3]]
- input: { mat: [[1, 1, 1], [1, 1, 1], [1, 1, 0]] }
expected: [[4, 3, 2], [3, 2, 1], [2, 1, 0]]
- input: { mat: [[0, 1], [1, 1]] }
expected: [[0, 1], [1, 2]]
- input: { mat: [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]] }
expected: [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]]
description: |
Given an `m x n` binary matrix `mat`, return *the distance of the nearest* `0` *for each cell*.