A gambler with the devil's luck? A gambler with $1$ dollar intends to make repeated bets of $1$ dollar until he wins $20$ dollars or is ruined. Probabilities of  win/loss are $p$ and $(1-p)$, and each bet brings a gain/loss of $1$ dollar. 
Unfortunately, the devil is active, and ensures that every time he reaches $19, he loses! Obviously, the poor guy will get ruined sooner or later!
The question is, what is the expected number of bets he makes until he is ruined?

Let $f(n)$ be the expected number of bets given that the gambler has £$n$. (My gambler is British to save messing around with dollar signs).
for every integer $0<n<19$ we have 
$$f(n) = 1 + pf(n+1) + (1-p) f(n-1)$$
Solutions to this equation look like
$$f(n) = \alpha + \beta\left(\frac{1-p}p\right)^n + \frac n{1-2p}\tag 1$$
and by recursion this formula must hold for $0\leq 1\leq19$.
We must have $f(0)=0$ and because of the unholy involvement we have
$f(19) = 1+f(18)$, that is
$$\begin{align}
\alpha + \beta &= 0 \\
\alpha + \beta \left(\frac{1-p}p\right)^{19} + \frac {19}{1-2p} &= 
\alpha + \beta \left(\frac{1-p}p\right)^{18} + \frac {18}{1-2p} + 1
\end{align}$$
Rearranging
$$\begin{align}
\frac{1}{1-2p}&= \beta\left(\frac{1-p}p\right)^{18}\frac{2p-1}p \\
\beta &=-\left(\frac{1-p}p\right)^{-18}\frac{2p^2}{(1-2p)^2}
\end{align}$$
So substituting into $(1)$ we get the same answer as given by Did.
Edit:
As pointed out below this answer is invalid when $p=\frac 12$ because the particular solution $\frac{n}{1-2p}$ is infinite.  In this case notice that $f(n) = -n^2$ satisfies $f(n) = 1+\frac{f(n+1) + f(n-1)}2$ hence all solutions will be in the form $$f(n)  = \alpha + \beta n -n^2.$$ Which is solved as before with $\alpha = 0, \beta=37$.
