Jam City Interview Question

The wolf, the sheep and the cabbage riddle