LeetCode
Distribute Candies
Click
here
for an explanation.