I want to find minimum items of list B that forms list A. lets assume A=['abcdef'] and B=['abc','ad','adef','adef','bdf']. Then since items with index 0 and 2 contains all letters of list A, the answer will be 2. I used the combination to find all the possible combination of B. But I am not sure how to continue. It seems most optimized way is Brute Force.
A=['abcdef']
B=['abc','ad','adef','adef','bdf']
for L in range(0, len(B)+1):
for subset in itertools.combinations(B, L):
if subset==A:
print(subset)