feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent 9e6c6d256f
commit 65a8d525f5
203 changed files with 4526 additions and 0 deletions

View File

@@ -9,6 +9,28 @@ categories:
patterns:
- greedy
function_signature: "def construct_array(n: int, k: int) -> list[int]:"
test_cases:
visible:
- input: { n: 3, k: 1 }
expected: [1, 2, 3]
- input: { n: 3, k: 2 }
expected: [1, 3, 2]
hidden:
- input: { n: 2, k: 1 }
expected: [1, 2]
- input: { n: 5, k: 1 }
expected: [1, 2, 3, 4, 5]
- input: { n: 5, k: 4 }
expected: [1, 5, 2, 4, 3]
- input: { n: 6, k: 3 }
expected: [1, 4, 2, 3, 5, 6]
- input: { n: 10, k: 5 }
expected: [1, 6, 2, 5, 3, 4, 7, 8, 9, 10]
- input: { n: 4, k: 3 }
expected: [1, 4, 2, 3]
description: |
Given two integers `n` and `k`, construct a list `answer` that contains `n` different positive integers ranging from `1` to `n` and obeys the following requirement: