I am facing some problem in this function. I am unable to understand the math behind the percentage…

What is meant by this particular line,
“The chart should show the percentage spent in each category passed in to the function. The percentage spent should be calculated only with withdrawals and not with deposits.” - (This is quoted from the prompt)

Just give me the hint of the math, I hope i will be able to solve it
Thanks it advance…

Please provide a link to the challenge, so we could check the entire description.

But basically, you are supposed to add up the money spent per category. Only the money spent though.
So if you got a category “Dog” and spent 20, 50 and 30, but somehow win a prize for 80 and got another category “Cat” where you got 50 spent → so in total 130 spent.
Then the chart should show for Dog 80/130*100% and for Cat 50/130/100%. The earned money doesn’t matter.
Also in this challenge % are to be rounded down to the nearest 10%.