Back to problems

Calculate Tax from Progressive Brackets

Algorithm · Gusto · Medium

Implement calculateProgressiveTax(income, upperBounds, ratesBps), returning one integer that represents the total tax due in minor currency units. The value income is a nonnegative integer. The array ratesBps provides one marginal rate for every bracket, expressed in basis points, where $$10{,}000$$ basis points equals $$100\%$$. Let $$m$$ be the number of rates; then upperBounds.length equals $$m - 1$$. The first bracket is $$\left[0, \text{upperBounds}[0]\right)$$ when $$m…

Checking your access…