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