
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
As you iterate through the tax brackets, keep track of the previous tax bracket’s upper bound in a variable called prev. If there is no previous tax bracket, use 0 instead.
The amount of money in the ith tax bracket is min(income, upperi) - prev.