You are given a 0-indexed 2D integer array brackets where brackets[i] = [upper_i, percent_i] means that the ith tax bracket has an upper bound of upper_i and is taxed at a rate of percent_i. The brackets are sorted by upper bound (i.e., upper_{i-1} < upper_i for 0 < i < brackets.length).
Tax is calculated as follows:
upper_0 dollars earned are taxed at a rate of percent_0.upper_1 - upper_0 dollars earned are taxed at a rate of percent_1.upper_2 - upper_1 dollars earned are taxed at a rate of percent_2.You are given an integer income representing the amount of money you earned. Return the amount of money that you have to pay in taxes. Answers within 10^-5 of the actual answer will be accepted.
1 <= brackets.length <= 1001 <= upper_i <= 10000 <= percent_i <= 1000 <= income <= 1000upper_i is sorted in ascending orderupper_i are uniqueincomebrackets = [[3,50],[7,10],[12,25]], income = 102.65000brackets = [[1,0],[4,25],[5,50]], income = 20.25000brackets = [[2,50]], income = 00.00000