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

@@ -11,6 +11,32 @@ patterns:
- two-pointers
- greedy
function_signature: "def num_rescue_boats(people: list[int], limit: int) -> int:"
test_cases:
visible:
- input: { people: [1, 2], limit: 3 }
expected: 1
- input: { people: [3, 2, 2, 1], limit: 3 }
expected: 3
- input: { people: [3, 5, 3, 4], limit: 5 }
expected: 4
hidden:
- input: { people: [1], limit: 3 }
expected: 1
- input: { people: [5, 5, 5, 5], limit: 5 }
expected: 4
- input: { people: [1, 1, 1, 1], limit: 3 }
expected: 2
- input: { people: [1, 2, 3, 4, 5], limit: 5 }
expected: 3
- input: { people: [2, 2, 2, 2], limit: 4 }
expected: 2
- input: { people: [3, 8, 1, 4, 6, 5, 2, 7], limit: 9 }
expected: 5
- input: { people: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], limit: 2 }
expected: 5
description: |
You are given an array `people` where `people[i]` is the weight of the i<sup>th</sup> person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries **at most two people** at the same time, provided the sum of the weight of those people is at most `limit`.