The Calculate Amount Paid in Taxes interview question involves calculating progressive income tax based on brackets. You are given a 2D array brackets where each entry is [upper_limit, percent] and an income value. Each bracket applies to the portion of income that falls between its upper limit and the previous bracket's limit. This Calculate Amount Paid in Taxes coding problem is a simulation of financial logic.
Stripe and Bloomberg use this to test a candidate's ability to handle ranges and iterative calculations. It requires careful subtraction to determine the "taxable amount" within each specific bracket. It's a great test for precision (handling floating point results) and boundary conditions (income exactly at a bracket limit).
This follows the Array, Simulation interview pattern. You iterate through the brackets, calculating how much of the user's income falls into the current slice, applying the percentage, and adding it to a running total.
Brackets: [[3, 50], [7, 10], [12, 25]], Income: 10
In progressive calculation problems, always keep track of the "previous limit." This allows you to calculate the delta (current - previous) which is the actual taxable amount for that specific tier. Clear variable naming (e.g., taxable_income, bracket_width) helps avoid logic errors.