A knight and a dragon were dueling on a remote island. After a long time, they were tired of battle and decided to instead fight with their wits. The island consists of 7 different kinds of poison fruits, namely type 1, type 2, ... type 7. These fruits are magical and they work in a special way. If you eat a fruit of type i, the only way to cure yourself is by eating a fruit of type higher than i. If not, you will die exactly 1 hour after eating the fruit. Thus if you eat a type 7 fruit to start with, you are guaranteed to die because there is no higher level fruit. A more complex example: If you eat a type 2 fruit followed by a type 1 fruit and then a type 2 fruit and finally a type 3 fruit, you are cured. The type 1 fruit is ineffective and you are still affected by type 2. The type 2 fruit is also ineffective. Finally, the type 3 fruit neutralizes the type 2 poison and you are cured. The catch is that the type 7 fruit is on top of a mountain and is accessible only by the dragon.
The knight and the dragon will meet for dinner and will give each other a fruit that they are supposed to eat. Is it possible for the knight to guarantee survival? Is it possible for the dragon to guarantee survival?
--- via n1b-algo blog.