feat(content): function signatures + test cases
This commit is contained in:
@@ -8,6 +8,30 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def can_place_flowers(flowerbed: list[int], n: int) -> bool:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { flowerbed: [1, 0, 0, 0, 1], n: 1 }
|
||||
expected: true
|
||||
- input: { flowerbed: [1, 0, 0, 0, 1], n: 2 }
|
||||
expected: false
|
||||
hidden:
|
||||
- input: { flowerbed: [0], n: 1 }
|
||||
expected: true
|
||||
- input: { flowerbed: [1], n: 0 }
|
||||
expected: true
|
||||
- input: { flowerbed: [0, 0, 0, 0, 0], n: 3 }
|
||||
expected: true
|
||||
- input: { flowerbed: [0, 0, 0, 0, 0], n: 4 }
|
||||
expected: false
|
||||
- input: { flowerbed: [1, 0, 0, 0, 0, 1], n: 1 }
|
||||
expected: true
|
||||
- input: { flowerbed: [0, 0, 1, 0, 0], n: 2 }
|
||||
expected: true
|
||||
- input: { flowerbed: [1, 0, 1, 0, 1], n: 1 }
|
||||
expected: false
|
||||
|
||||
description: |
|
||||
You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in **adjacent** plots.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user