## 10 Reputation

17 years, 291 days

## 4 possible combinations...

Sorry for not being very clear.  The F values cannot succeed any later F or S values in the original list L=[S1, F1, F2, S2].  For example F1 can only exist in L[1] or L[2], F2 can only exist in L[2] and L[3] (as F2 cannot exist before F1 in the list) etc.   Therefore there exist 4 possible combinations:

[S1, F1, F2, S2], [F1, S1, F2, S2], [F1, F2, S1, S2], [F1, F2, S2, S1]

## 4 possible combinations...

Sorry for not being very clear.  The F values cannot succeed any later F or S values in the original list L=[S1, F1, F2, S2].  For example F1 can only exist in L[1] or L[2], F2 can only exist in L[2] and L[3] (as F2 cannot exist before F1 in the list) etc.   Therefore there exist 4 possible combinations:

[S1, F1, F2, S2], [F1, S1, F2, S2], [F1, F2, S1, S2], [F1, F2, S2, S1]

## Thanks for the answer.  The provide...

Thanks for the answer.  The provided solution will only work if F1 is at the start of the list.  How would I go about writing code for F exisiting elsewhere.  For example:

S1, F1, F2, S2

There exist 4 possible combinations:

[S1, F1, F2, S2], [F1, S1, F2, S2], [F1, F2, S1, S2], [F1, F2, S2, S1],

## Thanks for the answer.  The provide...

Thanks for the answer.  The provided solution will only work if F1 is at the start of the list.  How would I go about writing code for F exisiting elsewhere.  For example:

S1, F1, F2, S2

There exist 4 possible combinations:

[S1, F1, F2, S2], [F1, S1, F2, S2], [F1, F2, S1, S2], [F1, F2, S2, S1],