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

@@ -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.