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

@@ -8,6 +8,30 @@ categories:
patterns:
- greedy
function_signature: "def candy(ratings: list[int]) -> int:"
test_cases:
visible:
- input: { ratings: [1, 0, 2] }
expected: 5
- input: { ratings: [1, 2, 2] }
expected: 4
hidden:
- input: { ratings: [1] }
expected: 1
- input: { ratings: [1, 2, 3, 4, 5] }
expected: 15
- input: { ratings: [5, 4, 3, 2, 1] }
expected: 15
- input: { ratings: [1, 3, 2, 2, 1] }
expected: 7
- input: { ratings: [1, 2, 3, 1, 0] }
expected: 9
- input: { ratings: [1, 3, 4, 5, 2] }
expected: 11
- input: { ratings: [1, 1, 1, 1] }
expected: 4
description: |
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`.