In the first case ( **a** ) the sequence of the outcomes is something like $H^j T^k H$ with $j\geq 0$ and $k\geq 1$. Such a sequence has length $j+k+1$, hence the expected number of coin flips is given by: $$\sum_{j\geq 0}\sum_{k\geq 1}\frac{j+k+1}{2^{j+k+1}}=\sum_{h,k\geq 1}\frac{h+k}{2^{h+k}}=4.$$ In the second case ( **b** ), the sequence of outcomes is a string over $\\{H,TH\\}$ plus a $TT$ suffix. The number of strings of length $N$ over $\Sigma=\\{H,TH\\}$ is given by the $(N+1)$-th Fibonacci number $F_{N+1}$, hence the expected number of coin flips is given by: $$ 2+\sum_{N=0}^{+\infty}\frac{N\cdot F_{N+1}}{2^{N+2}}=6.$$