Back to problems

Calculate Amount Paid in Taxes

Algorithm · Snowflake · Easy

You receive a zero-indexed two-dimensional integer array named brackets. Each entry brackets[i] = [upperi, percenti] describes tax tier i: upperi is that tier's maximum income limit, while percenti is the percentage charged for that tier. The entries appear in increasing order of upperi, and no two tiers share the same upper limit. Taxes use a progressive system: the portion of income through the first tier's limit uses its percentage, and every later portion uses the…

Checking your access…