Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
When is it impossible to feed all the hamsters?
When one or more hamsters do not have an empty space adjacent to it.
Assuming all previous hamsters are fed. If there is a hamster at index i and you are able to place a bucket at index i - 1 or i + 1, where should you put it?
It is always better to place a bucket at index i + 1 because it can feed the next hamster as well.