Statement
You are given information about recipes, and its corresponding ingredients are provided in the 2D array ingredients. The recipes[i], can be prepared if all the necessary ingredients listed in ingredients[i] are available. Some ingredients might need to be created from other recipes, meaning ingredients[i] may contain strings that are also in recipes.
Additionally, you have a string array supplies that contains all the ingredients you initially have, and you have an infinite supply of each.
Return a list of all the recipes you can create. The answer can be returned in any order.
Note: It is possible for two recipes to list each other as ingredients. However, if these are the only two recipes provided, the expected output is an empty list.
Constraints:
nrecipes.lengthingredients.lengthningredients[i].length,supplies.lengthrecipes[i].length,ingredients[i][j].length,supplies[k].lengthrecipes[i],ingredients[i][j], andsupplies[k]consist only of lowercase English letters.All the combined values of
recipesandsuppliesare unique.Each
ingredients[i]doesn’t contain any duplicate values.