You are given a brackets where brackets[i] = [upper_i, percent_i] indicates that the upper_i and is taxed at a rate of percent_i percent. The brackets are sorted in strictly increasing order by their upper bounds.
You are also given an integer income representing your total income.
The amount of tax paid is calculated as follows:
The first bracket taxes the portion of income from upper_0 at a rate of percent_0 percent.
Each subsequent bracket taxes the portion of income that lies strictly between the previous bracket’s upper bound and upper_i at a rate of percent_i percent.
If income is less than an upper bound, only the amount earned within that bracket is taxed.
Return the total amount paid in taxes. Answers within
Constraints:
brackets.length
upper_i
percent_i
income
upper_i is sorted in ascending order.
All the values of upper_i are unique.
The upper bound of the last tax bracket is greater than or equal to income.
You are given a brackets where brackets[i] = [upper_i, percent_i] indicates that the upper_i and is taxed at a rate of percent_i percent. The brackets are sorted in strictly increasing order by their upper bounds.
You are also given an integer income representing your total income.
The amount of tax paid is calculated as follows:
The first bracket taxes the portion of income from upper_0 at a rate of percent_0 percent.
Each subsequent bracket taxes the portion of income that lies strictly between the previous bracket’s upper bound and upper_i at a rate of percent_i percent.
If income is less than an upper bound, only the amount earned within that bracket is taxed.
Return the total amount paid in taxes. Answers within
Constraints:
brackets.length
upper_i
percent_i
income
upper_i is sorted in ascending order.
All the values of upper_i are unique.
The upper bound of the last tax bracket is greater than or equal to income.