A basketball player is executing 10 free throws, with probability getting scored $p$ at a single throw. Let $ Y $ be the longest continuous string of hits and the $ X$ number of hits. Calculate $P(X= 7|Y=5)$.
I believe that should be ($q=1-p$): \begin{eqnarray} P(X = 7|Y = 5)&=& {P((X = 7)\cap (Y = 5))\over P(Y=5) }\\ &=& {2\cdot {4\choose 2}p^7q^3+4\cdot {3\choose 2}p^7q^3 \over 2p^5q+4p^5q^2}\\ &=& {12p^2q^2\over 2+3q}\\ \end{eqnarray}
Is that OK?
Since $Y\ge (N-1)/2$, streak of $Y=5$ hits is always the largest.
We can place streak of 5 either in the beginning or the end of the sequence (and then we need only one miss to separate it from the rest), or in the middle (then we need two misses): $$ HHHHHM....\\ ….MHHHHH\\ MHHHHHM...\\ .MHHHHHM..\\ ..MHHHHHM.\\ ...MHHHHHM $$
Thus probability of $Y=5$: $$ P(Y=5) = 2p^5q + 4p^5q^2 $$
$$P(X=7\cap Y=5) = 2p^5q\times {4\choose2}p^2q^2+4p^5q^2\times {3\choose2}p^2q =24p^7q^3$$