 All Problems
Find All Possible Recipes from Given Supplies
medium
topological sort
graph
hash table
amazon
google
facebook

You have n recipes and an unlimited supply of some supplies. Each recipe has a list of ingredients. An ingredient can be a supply or another recipe.

Return a list of all recipes you can make. You can make a recipe if all its ingredients are available (from supplies or made recipes).

Example 1:

Input: recipes = ["bread"], ingredients = [["yeast","flour"]], supplies = ["yeast","flour","corn"]
Output: ["bread"]

Example 2:

Input: recipes = ["bread","sandwich"], ingredients = [["yeast","flour"],["bread","meat"]], supplies = ["yeast","flour","meat"]
Output: ["bread","sandwich"]

Constraints:

  • 1 <= n <= 100
  • 1 <= ingredients[i].length <= 100
Run to check your code against the sample cases, or submit to run every case