The answer found here is so close to what i am looking for but not quite there. What I am looking is I have an array of integers, and a value that I need to subtract from across said array. i want to zero out each index before moving on to the next. I don't want any numbers less than 0 nor do i want any decimals.. so, for subtractFromSet([4, 5, 6, 7, 8], 25) instead of returning:
[0,0,0.666666666666667,1.666666666666666,2.666666666666666]
I want:
[0,0,0,0,5]