2303. Calculate Amount Paid in Taxes

Обновлено: 2024-03-12
1 мин
[]

Содержание

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