Post History
Pyth, 15 bytes !f.A-VtTsM._T.p Try it online! Outputs True if no valid recipe exists, False if one does. If truthy/falsy outputs are allowed, the ! can be removed, to just output all valid per...
Answer
#1: Initial revision
# [Pyth], 15 bytes !f.A-VtTsM._T.p [Try it online!][TIO-ltadqqft] Outputs True if no valid recipe exists, False if one does. If truthy/falsy outputs are allowed, the `!` can be removed, to just output all valid permutations. Takes input as lists, not sets. !f.A-VtTsM._T.p .p All permutations of parts f Filter permutations ._T All prefixes of parts sM Sum prefixes -VtT Filter each part for ingredients not contained in previous part .A Check all parts had something new ! Check whether no permutations remain [Pyth]: https://github.com/isaacg1/pyth [TIO-ltadqqft]: https://tio.run/##K6gsyfj/XzFNz1E3rCSk2FcvPkSv4P//aEMdIx3jWJ1oIDLSMQGSIAEQbRwLAA "Pyth – Try It Online"