A general solution for constraints problems with line arrangement :
1. Represent the constraints at the left most. The first constraint is 3 consecutive heads
HHH_ _
2. Fill up the right most blanks
It can be TT and so HHHTT
3. Shift together what is constrained, one position at a time to the right and count the number of valid cases.
Here they are HHHTT, THHHT, TTHHH. So there are 3 cases
4. See if what is not constrained can be reordered.
In this case it is TT and cannot be reordered.
If it can be reordered, repeat step 3.
5. See if what is not constrained can change
If can change, make the change and go to step 2 else stop.
Here TT can change to TH or HT. Let us take TH.
Finally, we get the valid cases HHHTH and HTHHH. So there are 2 cases
The total number of cases for 3 consecutive Heads is 5.
Similarly we can do for the constraints 4 and 5 consecutive heads.
Note: When there are many constraints such as 3,4 or 5 consecutive heads start with the least constrained i.,e 3 here.
_________________
Srinivasan Vaidyaraman
Magical Logicians
https://magical-logicians-sat-gmat-gre.business.siteHolistic and Holy Approach