feat(content): more test cases
This commit is contained in:
@@ -11,6 +11,28 @@ patterns:
|
||||
- greedy
|
||||
- heap
|
||||
|
||||
function_signature: "def least_interval(tasks: list[str], n: int) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { tasks: ["A", "A", "A", "B", "B", "B"], n: 2 }
|
||||
expected: 8
|
||||
- input: { tasks: ["A", "C", "A", "B", "D", "B"], n: 1 }
|
||||
expected: 6
|
||||
- input: { tasks: ["A", "A", "A", "B", "B", "B"], n: 3 }
|
||||
expected: 10
|
||||
hidden:
|
||||
- input: { tasks: ["A", "A", "A", "B", "B", "B"], n: 0 }
|
||||
expected: 6
|
||||
- input: { tasks: ["A", "A", "A", "A", "A", "A", "B", "C", "D", "E", "F", "G"], n: 2 }
|
||||
expected: 16
|
||||
- input: { tasks: ["A"], n: 5 }
|
||||
expected: 1
|
||||
- input: { tasks: ["A", "B", "C", "D", "E", "A", "B", "C", "D", "E"], n: 4 }
|
||||
expected: 10
|
||||
- input: { tasks: ["A", "A", "B", "B", "C", "C", "D", "D"], n: 3 }
|
||||
expected: 8
|
||||
|
||||
description: |
|
||||
You are given an array of CPU `tasks`, each labelled with a letter from A to Z, and a number `n`. Each CPU interval can be idle or allow the completion of one task. Tasks can be completed in any order, but there's a constraint: there has to be a gap of **at least** `n` intervals between two tasks with the same label.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user