feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,26 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def calculate_tax(brackets: list[list[int]], income: int) -> float:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { brackets: [[3, 50], [7, 10], [12, 25]], income: 10 }
|
||||
expected: 2.65
|
||||
- input: { brackets: [[1, 0], [4, 25], [5, 50]], income: 2 }
|
||||
expected: 0.25
|
||||
- input: { brackets: [[2, 50]], income: 0 }
|
||||
expected: 0.0
|
||||
hidden:
|
||||
- input: { brackets: [[10, 10]], income: 10 }
|
||||
expected: 1.0
|
||||
- input: { brackets: [[5, 100]], income: 5 }
|
||||
expected: 5.0
|
||||
- input: { brackets: [[10, 0], [20, 50]], income: 15 }
|
||||
expected: 2.5
|
||||
- input: { brackets: [[100, 10], [200, 20], [300, 30]], income: 250 }
|
||||
expected: 45.0
|
||||
|
||||
description: |
|
||||
You are given a **0-indexed** 2D integer array `brackets` where `brackets[i] = [upper_i, percent_i]` means that the i<sup>th</sup> tax bracket has an upper bound of `upper_i` and is taxed at a rate of `percent_i`. The brackets are **sorted** by upper bound (i.e., `upper_{i-1} < upper_i` for `0 < i < brackets.length`).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user