
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try to solve the problem using combinatorics.
If the limit didn’t exist, the problem would be distributing <code>n</code> candies between <code>3</code> children.
The answer to the above problem would be <code>C(n + 2, 2)</code>.
Now try to combine this with the Inclusion-exclusion principle.
Apart from the above solution, there are other mathematical solutions that you can think of.