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

@@ -10,6 +10,24 @@ categories:
patterns:
- two-pointers
function_signature: "def rotate(nums: list[int], k: int) -> list[int]:"
test_cases:
visible:
- input: { nums: [1, 2, 3, 4, 5, 6, 7], k: 3 }
expected: [5, 6, 7, 1, 2, 3, 4]
- input: { nums: [-1, -100, 3, 99], k: 2 }
expected: [3, 99, -1, -100]
- input: { nums: [1, 2], k: 1 }
expected: [2, 1]
hidden:
- input: { nums: [1, 2, 3], k: 4 }
expected: [3, 1, 2]
- input: { nums: [1], k: 0 }
expected: [1]
- input: { nums: [1, 2, 3, 4, 5], k: 5 }
expected: [1, 2, 3, 4, 5]
description: |
Given an integer array `nums`, rotate the array to the right by `k` steps, where `k` is non-negative.