Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
We have to give each bag to one of the children. How can we enumerate all of the possibilities?
Use recursion and keep track of the current number of cookies each child has. Once all the bags have been distributed, find the child with the most cookies.