Practice Calculate Amount Paid in Taxes
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
brackets lists increasing upper income bounds and their percentage rates. Tax the portion from zero through the first bound at the first rate, the portion above that bound through the next at the next rate, and so on. Tax only the portions actually earned, rather than applying one rate to all income. Return total tax for income; answers within 10^-5 are accepted.
Source: Calculate Amount Paid in Taxes on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
brackets = [[3,50],[7,10],[12,25]], income = 10
2.65000
# Example 2
brackets = [[1,0],[4,25],[5,50]], income = 2
0.25000
# Example 3
brackets = [[2,50]], income = 0
0.00000
Constraints
Related LeetCode Problems
Practice more problems similar to Calculate Amount Paid in Taxes.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.