FastPrepFind Cookable Recipes
Problems/Find Cookable Recipes

Find Cookable Recipes

Palantir logoPalantir● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Palantir intern onsite interview. The report asks for selecting the possible recipes.

The report does not give the recipe data or matching rules. Here, every listed name must be available. Names are case-sensitive, quantities are ignored, and ingredients are not used up. Return recipe indices in input order.

Our version is about 70% the same as the reported question.

You are given a list of recipes. Each recipe is a list of ingredient names. Return the zero-based indices of the recipes that can be made from available, in increasing index order.

For this exercise, assume a recipe is possible when every ingredient name it lists is available. Names are case-sensitive. Quantities are not modeled, so repeated names do not increase a requirement. Check each recipe independently: ingredients are not used up, and making a recipe does not add a new ingredient.

Return an empty list when no recipe is possible.

Function

possibleRecipes(recipes: String[][], available: String[]) → int[]

Examples

Example 1

recipes = [["flour","egg"],["rice","water"],["egg"]]available = ["egg","flour"]return = [0,2]

Recipe 0 needs flour and egg, which are both available. Recipe 1 is missing rice and water. Recipe 2 only needs egg.

Example 2

recipes = [["Salt"],["salt"]]available = ["salt"]return = [1]

Names are case-sensitive. The available name salt satisfies recipe 1 but does not satisfy Salt in recipe 0.

Example 3

recipes = []available = ["egg"]return = []

There are no recipes to select.

Constraints

  • 0 <= recipes.length <= 200.
  • Each recipe contains 1 to 50 ingredient names.
  • 0 <= available.length <= 1000.
  • The total number of ingredient-name occurrences across all recipes and available is at most 2000.
  • Every ingredient name has 1 to 20 characters.
  • Ingredient names contain only English letters, uppercase or lowercase.

More Palantir interview questions

  • Map and Accumulate Learning QueriesONSITE INTERVIEW · Seen Oct 2026
  • Relational Learning QueriesONSITE INTERVIEW · Seen Apr 2025
  • Find Unmet Users With Shared InterestsONSITE INTERVIEW · Seen Mar 2025
  • Maximum Profit with Repeated Stock TradesONSITE INTERVIEW · Seen Sep 2024
  • Minimum Calls for Repeated API LookupsONSITE INTERVIEW · Seen Oct 2022
  • Simulate Multiplayer WarONSITE INTERVIEW · Seen Nov 2019
  • Trace Terminal Company OwnershipONSITE INTERVIEW · Seen Nov 2019
  • Query Words Within K PositionsPHONE SCREEN · Seen Nov 2026
  • Basic Item DiscountsOA · Seen Nov 2026
  • Optimize Discount Selection Under a Point BudgetOA · Seen Nov 2026

Similar questions at other companies

  • Filter Pins by Excluded IDsPinterest · ONSITE INTERVIEWPinterest interview questions
  • Longest Dictionary Word from Nine LettersGoogle · ONSITE INTERVIEWGoogle interview questions
  • K-Second Message SuppressionMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Logger Rate LimiterAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Loyal Customers by Two-Day Product VarietyAmazon · ONSITE INTERVIEW
  • Find Nodes with Invalid Parent LevelsZip · ONSITE INTERVIEWZip interview questions
  • Count Word FrequenciesBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Most Voted CandidateExpedia · ONSITE INTERVIEWExpedia interview questions
  • List Each Name Once, AlphabeticallyDocuSign · ONSITE INTERVIEWDocuSign interview questions
  • Process Shopping Records, Promotions, and Display OrderInstacart · PHONE SCREEN · ONSITE INTERVIEWInstacart interview questions

Interview reports that mention this question

  • Palantir FDSE Karat and Learning: 7 Experiences (Part 2 of 2)

Palantir interview experiences

  • Palantir FDSE Experienced-Hire Interviews: 5 Experiences
  • Palantir FDSE New Grad OA Questions: 6 Experiences (Part 2 of 2)
  • Palantir FDSE New Grad Interviews: 5 Experiences (Part 1 of 2)
  • Palantir FDSE Intern OA and Interviews: 3 Experiences
  • Palantir FDSE OA and Interviews: 16 Experiences (Part 1 of 2)
All Palantir interview questionsSee Palantir hiring insights
Saved
class Solution {
    public int[] possibleRecipes(String[][] recipes, String[] available) {
        return new int[0];
    }
}
Checking account…