I'm quite sure this question involves some sort of distribution. You might want to search about the Negative Binomial distribution. Given the probability of a success $p$, calculate the number of times, $n$, you will need to achieve $r$ successes.
I will shamelessly copy the equation from Shyam
$$P(X=n)=\binom{n-1}{r-1}p^{r-1}{(1-p)}^{n-r}\times p$$
There are 3 parts to this equation (RHS), namely:
-
Basically, the $\binom{n-1}{r-1}$ means there are these number of ways where you can select $r-1$ successes, out of $n-1$ tries.
-
The next part, $p^{r-1}{(1-p)}^{n-r}$ means, assuming the event of success is independent, once again, $r-1$ successes and $n-r$ failures. Consider that $(n-r) + (r-1) = (n-1)$, which is the total number of tries so far.
-
Multiply that with $p$, which is the probability of the last success, and you get your answer.