feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent 98ebb1600f
commit 16b02451d0
94 changed files with 1840 additions and 0 deletions

View File

@@ -9,6 +9,22 @@ categories:
patterns:
- matrix-manipulation
function_signature: "def rotate(matrix: list[list[int]]) -> None:"
test_cases:
visible:
- input: { matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] }
expected: [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
- input: { matrix: [[5, 1, 9, 11], [2, 4, 8, 10], [13, 3, 6, 7], [15, 14, 12, 16]] }
expected: [[15, 13, 2, 5], [14, 3, 4, 1], [12, 6, 8, 9], [16, 7, 10, 11]]
hidden:
- input: { matrix: [[1]] }
expected: [[1]]
- input: { matrix: [[1, 2], [3, 4]] }
expected: [[3, 1], [4, 2]]
- input: { matrix: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] }
expected: [[13, 9, 5, 1], [14, 10, 6, 2], [15, 11, 7, 3], [16, 12, 8, 4]]
description: |
You are given an `n × n` 2D matrix representing an image. Rotate the image by **90 degrees** (clockwise).