Hey tommylee.

In terms of the run problem, you will know that you get a specific set of values corresponding to the run which are n X's followed by m Y's.

Since every trial is independent with a given probability of obtaining an individual X with some probability p and an individual Y with an individual probability 1-p, then you can use the independence criterion P(A and B) = P(A)P(B) to get the final probability.

For the rest, you should consider how to calculate the distribution symbolically (using the above) to get means and covariance terms with those formulae.