← 返回 microsoft 的题目列表Recipe Making
类型:online_judge
Given a list of recipes (array of strings) and available ingredients (string of lowercase characters), determine how many recipes can be fully made using the available ingredients.
Input
recipes: An array of strings where each string represents a recipe and each character represents an ingredient needed for that recipe.
ingredients: A string of lowercase letters where each character represents one unit of an available ingredient.
Output
An integer representing the number of recipes that can be fully made with the available ingredients.
Example 1
Input: recipes = ["aabb", "abc", "aaaa"], ingredients = "aabbc"
Output: 2
Explanation In the example, you can make the first and second recipes.
Notes
The alphabet is limited to lowercase letters.
Each letter represents one unit of an ingredient.
The number of recipes and ingredients will not exceed 100,000.
Consider edge cases such as empty strings.
Example
Input
{"recipes": ["aabb", "abc", "aaaa"], "ingredients": "aabbc"}