As reported: Gusto Senior Software Engineer onsite (July 2026), pair programming: calculate the US federal income tax for a given user using the IRS tax brackets, in a CoderPad with only a
mainfunction. The round was mostly about object-oriented design — classes per tax bracket, a decimal type for money — iterating the brackets to compute the tax owed in each. Follow-up: how to represent different filing statuses and tax years. Also reported as the "work exercise" of an earlier Gusto loop (2025): calculate federal tax from tax brackets.
Income tax is progressive: each bracket's rate applies only to the part of the income inside that bracket. Design and implement a calculator that supports several tax years and filing statuses.
The code runner tests this interface (income in whole dollars, rates in whole percent, tax returned in cents so it is exact):
addSchedule(year, status, upperBounds, rates)— register the brackets for a year and filing status.rateshas one more entry thanupperBounds: income up toupperBounds[0]is taxed atrates[0], income aboveupperBounds[i−1]up toupperBounds[i]atrates[i], and everything above the last bound at the last rate. Returnsfalse(and stores nothing) if that year and status already exist, the lengths do not fit, or the bounds are not positive and strictly increasing.tax(year, status, income)→ the tax in cents, or-1if no schedule exists for that year and status.marginalRate(year, status, income)→ the rate (percent) of the bracket the income's last dollar falls in;-1if no schedule.
Example (2024 brackets: single 10% ≤ 11,600 < 12% ≤ 47,150 < 22% ≤ 100,525 < 24% ≤ 191,950 < 32% ≤ 243,725 < 35% ≤ 609,350 < 37%; married filing jointly bounds 23,200 / 94,300 / 201,050 / 383,900 / 487,450 / 731,200)
tax(2024, "single", 11600) -> 116000 ($1,160.00)
tax(2024, "single", 50000) -> 605300 ($1,160 + $4,266 + $627 = $6,053.00)
tax(2024, "married_joint", 50000) -> 553600 ($2,320 + $3,216)
marginalRate(2024, "single", 50000) -> 22
tax(2024, "single", 0) -> 0
marginalRate(2024, "single", 11600) -> 10 (a bound belongs to the lower bracket)
tax(2023, "single", 50000) -> -1 (no 2023 schedule loaded)
Code runner format: LeetCode design format — method names and arguments as two JSON lines; the runner prints every result (null for the constructor).