Pramp - Award Budget Cuts Solution

Viewed 437

I have a hard time wrapping my head around the solution given by Pramp for the problem:

Award Budget Cuts

https://www.pramp.com/challenge/r1Kw0vwG6OhK9AEGAyWV

I do not seem to be able to find some other explanations of what they are doing in their solution.

I kinda understand the other ways of solving it, suggested by other users here:

https://codereview.stackexchange.com/questions/194272/award-budget-cuts-implementation-in-java

But I am trying to understand the reasoning behind the:

surplus1 = surplus0 - 1*(grantsArray[0]-grantsArray[1])
surplus2 = surplus1 - 2*(grantsArray[1]-grantsArray[2])
surplus3 = surplus2 - 3*(grantsArray[2]-grantsArray[3])

Really don't understand that part...

0 Answers
Related