AWS CloudFormation resolves resource dependencies using topological sort: start with what's available, then create anything whose dependencies are all met. This problem mirrors that exact process with recipes and ingredients.
Recipes depend on ingredients, and some ingredients are themselves recipes. You need to figure out which recipes can be made from the available base supplies. You'll practice Kahn's algorithm (BFS-based topological sort) and learn to detect when dependencies form cycles that make production impossible.