2303. Calculate Amount Paid in Taxes

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2303

class Solution:
    def calculateTax(self, brackets: List[List[int]], income: int) -> float:
        res = prev = 0
        for upper, percent in brackets:
            res += max(0, min(income, upper) - prev) * percent
            prev = upper
        return res / 100