You are viewing a single comment's thread. Return to all comments →
SPOILER! Hint if you're stuck:
Giving chocolate to everyone except the chosen person is the same as taking chocolate away from the chosen person. We don't care about how much chocolate they end up with, only that each person's amount is equal.
1 3 5
6 8 5 <-
1 3 5
1 3 0 <-
The two results are the same relative to themselves, just shifted:
1 3 0
+ 5 5 5
6 8 5
The problem becomes much simpler now.
Also remember to look for caching opportunities.
Great remark, when you re-state the problem like this, it becomes easy. Thanks!
Thank you very much. When explain like that, the problems seem easier than
I did the same thing but my last testcase is going wrong :/
How does it make this easier?
Yes this helps us to change our range update to a single element update !