feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent b434eb3a49
commit a7d29b7cce
203 changed files with 4526 additions and 0 deletions

View File

@@ -10,6 +10,30 @@ categories:
patterns:
- monotonic-stack
function_signature: "def car_fleet(target: int, position: list[int], speed: list[int]) -> int:"
test_cases:
visible:
- input: { target: 12, position: [10, 8, 0, 5, 3], speed: [2, 4, 1, 1, 3] }
expected: 3
- input: { target: 10, position: [3], speed: [3] }
expected: 1
- input: { target: 100, position: [0, 2, 4], speed: [4, 2, 1] }
expected: 1
hidden:
- input: { target: 10, position: [], speed: [] }
expected: 0
- input: { target: 10, position: [0, 5], speed: [1, 1] }
expected: 2
- input: { target: 10, position: [6, 8], speed: [3, 2] }
expected: 2
- input: { target: 10, position: [2, 4], speed: [3, 2] }
expected: 1
- input: { target: 100, position: [0, 50, 99], speed: [1, 1, 1] }
expected: 3
- input: { target: 20, position: [0, 10], speed: [10, 5] }
expected: 1
description: |
There are `n` cars at given miles away from the starting mile `0`, travelling to reach the mile `target`.