Hi, given a pattern of result of tossing a coin ,how can one determine the number of tosses one needs to make to get that pattern?

E.g :

to get pattern

HTHT we need to make 20 tosses.

Is Pascal's triangle of any help here?

The total possible outcomes of tossing a coin n times is 2^n ,so how can this

help here?

Thanks.