2303. Calculate Amount Paid in Taxes
On This Page
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