Home / Expert Answers / Computer Science / task-1-you-are-given-n-recipes-the-k-th-of-which-is-represented-by-a-string-a-k-each-letter-of-t-pa477

(Solved): Task 1 You are given N recipes, the K-th of which is represented by a string A[K]. Each letter of t ...



Task 1 You are given

N

recipes, the

K

-th of which is represented by a string A[K]. Each letter of the string represents a single unit of an ingredient: for example, recipe "toast" requires two ur its of ingredient '

t

' and one unit of ingredients '

o

', '

a

' and '

s

'. Yourare also given a list of available ingredients represented by a string S. Which recipes can be prepared using ingredients from the list? Wite a function: def solution(A, S) given an array

A

consisting of

N

strings representing the recipes, and a string S representing the list of available ingredients, returns the number of recipes that can be prepared using available ingredients. Examples: Given "toast", "bread", "breada", "cheese"] and S = "abcdeeehrs", the function should return 2. With our ingredients, recipes "bread" and "cheese" can be prepared



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe