FastPrepAvailable Recipes from Initial Supplies
Problems/Available Recipes from Initial Supplies

Available Recipes from Initial Supplies

Amazon logoAmazon● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Amazon full-time phone screen. The report describes a recipe-dependency problem, with a directed acyclic graph and a topological order. We added the string array input, the rule that supplies never run out, what an empty recipe means, a fixed order for the result, the examples, and the limits. The named task is about 90% the same as the reported question.

You are given distinct recipe names in recipes. Row ingredients[i] lists everything needed to make recipes[i]. An ingredient can be an initial supply, another recipe, or a name that is unavailable.

Every initial supplies item is available in unlimited quantity. Whenever every ingredient of a recipe is available, that recipe also becomes available in unlimited quantity and can be used by other recipes. A recipe with no ingredients is available immediately. Recipe-to-recipe dependencies form a directed acyclic graph.

Return every recipe that can eventually become available, in the original order of recipes. Ingredients are never consumed. Initial supplies have distinct names and do not include recipe names.

Function

findAvailableRecipes(recipes: String[], ingredients: String[][], supplies: String[]) → String[]

Examples

Example 1

recipes = ["bread","sandwich"]ingredients = [["flour","water"],["bread","ham"]]supplies = ["flour","water","ham"]return = ["bread","sandwich"]

Bread needs flour and water, which are both supplies, so bread becomes available. Sandwich needs bread and ham, and both are now available. So the answer is bread, then sandwich.

Example 2

recipes = ["cake","icing","tea"]ingredients = [["flour","icing"],["sugar"],["water"]]supplies = ["sugar","water"]return = ["icing","tea"]

Icing needs only sugar, and tea needs only water. Both are supplies, so icing and tea become available. Cake also needs flour, which is neither a supply nor a recipe, so cake stays unavailable. The answer is icing, then tea.

Example 3

recipes = ["meal","base"]ingredients = [["base"],[]]supplies = []return = ["meal","base"]

Base has no ingredients, so it is available right away. Meal needs only base, so meal becomes available too. Return them in the original order of recipes, even though base was available first. The answer is meal, then base.

Constraints

  • 0 <= recipes.length <= 200 and ingredients.length == recipes.length.
  • 0 <= supplies.length <= 1000.
  • Names contain from 1 through 20 lowercase ASCII letters.
  • Every ingredient row contains distinct names; the total number of ingredient references is at most 10000.
  • Recipe names and supply names are distinct within each array and no recipe name is an initial supply.
  • The graph formed by references from one recipe to another is acyclic.

More Amazon Phone Screen questions

  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Search in a Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Second Largest Distinct ElementPHONE SCREEN · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Merge Event PreferencesAirbnb · PHONE SCREEN · ONSITE INTERVIEWAirbnb interview questions
  • Task Build Order and File-Change RerunsVanta · PHONE SCREEN
  • Topological Sort with Secondary OrderingRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Evaluate Formulas with Cycle DetectionInstacart · PHONE SCREEN · ONSITE INTERVIEWInstacart interview questions
  • Validate CSV References and Field DependenciesStripe · PHONE SCREENStripe interview questions
  • Recipes You Can PrepareIndeed · PHONE SCREENIndeed interview questions
  • Data Pipeline Steps with Search and Run OrderRippling · PHONE SCREENRippling interview questions
  • Propagate Spreadsheet Cell UpdatesOpenAI · PHONE SCREENOpenAI interview questions
  • Lexicographically Smallest Topological OrderCoinbase · PHONE SCREENCoinbase interview questions
  • Package Install OrderVerily · ONSITE INTERVIEW

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
See Amazon hiring insights
Saved
class Solution {
    public String[] findAvailableRecipes(String[] recipes, String[][] ingredients, String[] supplies) {
        // Write your code here.
    }
}
Checking account…