You are given:
ingredients[0..n-1]
.
recipes[j]
is itself a list of ingredients and is intended to represent a sequence of
consecutive
ingredients.
For each recipe, determine whether it can be formed by taking a contiguous subarray of ingredients (i.e., there exists an index s such that ingredients[s .. s + len(recipe)-1] equals the recipe exactly, element by element).
Return an array ans[0..m-1] of booleans.
ingredients
(length
n
)
recipes
(total
m
recipes)
ans
, where
ans[j] = true
if
recipes[j]
appears contiguously in
ingredients
, else
false
.
ingredients
arrives as a
data stream
and is too large to store fully?
1 <= n <= 2e5
1 <= m <= 2e5
<= 2e5