feat(content): more test cases
This commit is contained in:
@@ -8,6 +8,24 @@ categories:
|
||||
patterns:
|
||||
- matrix-traversal
|
||||
|
||||
function_signature: "def spiral_order(matrix: list[list[int]]) -> list[int]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] }
|
||||
expected: [1, 2, 3, 6, 9, 8, 7, 4, 5]
|
||||
- input: { matrix: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] }
|
||||
expected: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]
|
||||
hidden:
|
||||
- input: { matrix: [[1]] }
|
||||
expected: [1]
|
||||
- input: { matrix: [[1, 2, 3, 4]] }
|
||||
expected: [1, 2, 3, 4]
|
||||
- input: { matrix: [[1], [2], [3]] }
|
||||
expected: [1, 2, 3]
|
||||
- input: { matrix: [[1, 2], [3, 4]] }
|
||||
expected: [1, 2, 4, 3]
|
||||
|
||||
description: |
|
||||
Given an `m x n` `matrix`, return *all elements of the matrix in spiral order*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user