Skip to content

2115. Find All Possible Recipes from Given Supplies #1461

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to determine all possible recipes that can be created given a set of initial supplies and recipes that may depend on each other. The key challenge is to handle dependencies between recipes and ensure that all required ingredients (either from initial supplies or other recipes) are available.

Approach

  1. Identify Valid Recipes: First, filter out recipes that have ingredients not present in the initial supplies and are not other recipes. These recipes cannot be made under any circumstances.
  2. Build Dependency Graph: For each valid recipe, determine its dependencies on other recipes. This helps in constructing a directed graph where edges represent dependencies between recipes.
  3. Topologic…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Mar 21, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Mar 21, 2025
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants
Converted from issue

This discussion was converted from issue #1460 on March 21, 2025 16:15.