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

@@ -8,6 +8,24 @@ categories:
patterns:
- matrix-traversal
function_signature: "def transpose(matrix: list[list[int]]) -> list[list[int]]:"
test_cases:
visible:
- input: { matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] }
expected: [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
- input: { matrix: [[1, 2, 3], [4, 5, 6]] }
expected: [[1, 4], [2, 5], [3, 6]]
hidden:
- input: { matrix: [[1]] }
expected: [[1]]
- input: { matrix: [[1, 2], [3, 4]] }
expected: [[1, 3], [2, 4]]
- input: { matrix: [[1], [2], [3]] }
expected: [[1, 2, 3]]
- input: { matrix: [[1, 2, 3, 4]] }
expected: [[1], [2], [3], [4]]
description: |
Given a 2D integer array `matrix`, return *the **transpose** of* `matrix`.