Suppose we tossed a coin with probability of tails $p$ until we got $n$-th tails. What is the expected length of the longest consecutive string on heads under this condition?
Let’s denote the length of the streak of heads, that is exactly before $i$-th tails as $X_i$. It is not hard to see, that all $X_i$ are i.i.d. and are distributed geometrically with parameter $p$. Thus our question can be reworded in the following way:
Suppose $X_1, … , X_n$ are i.i.d. random variables, geometrically distributed with parameter $p$. What is $E[\max(X_1, … , X_n)]$?
If the exact answer is too complicated, then asymptotic is also OK.