- There are two kinds of items:
A
andB
- Each item
B
could be replaced byA'
andA"
- Given a list with items
A
andB
(the order is not important), generate the most quantity of target-lists only with itemsA
,A'
andA"
below the time limitt
- Each target-list is sorted after generation, so there isn't necessary to generate each permutation (only replacements are sufficient)
- The source list have an arbitrary size
- The number of unique possibilities is
n²
wheren
is the number ofB
items A
items doesn't need to be modified, so it could be reused
Given the source list:
[A, A, B, A, B]
These are the relevant target-lists:
[A, A, A', A, A']
[A, A, A", A, A']
[A, A, A", A, A"]
Notice the absence of [A, A, A', A, A"]
: as the target list is ordered, this option is not relevant.