Define $P(n)$ as the chance that he eventually runs out of money if he starts with $n$.The recurrence is $$P(n)=\frac 12P(n-1)+\frac 12P(n+2)\\P(0)=1$$ We can rewrite the recurrence as $P(n+2)=2P(n)-P(n-1)$. The characteristic equation is $x^3=2x-1$ with roots $1, \frac 12(\sqrt 5-1), \frac 12(-1-\sqrt 5)$ or $1,\phi-1,-\phi$.
The general solution is $P(n)=a1^n+b(\phi-1)^n+c(-\phi)^n$ with $a+b+c=1$ to match the condition $P(0)=1.$ $c$ must be $0$. If $c \gt 0$ the probability will be negative for large odd $n$ and greater than $1$ for large even $n$. If $c \lt 0$ the same will be true reversing odd and even. If he starts with a lot of money the chance of going broke becomes small, so $\lim_{n \to \infty}P(n)=0$, which tells us that the coefficient on $1^n$ is zero. We get $$P(n)=(\phi-1)^n$$
and in particular if he starts with just one dollar he has about $0.382$ chance of playing forever.
Let $e_k$ be the expected number of bets starting from $k$ dollars. Then
\begin{align}
e_{k}&=1+pe_{k+1}+qe_{k-1},\qquad k=1,2,\dots,n-1\\
e_n&=0,\\
e_0&=1+e_1.
\end{align}
The first equation can be written as
$$
e_{k+1}-e_k=(q/p)(e_k-e_{k-1})-1/p
$$
Applying this over and over, you get
\begin{align}
e_{k+1}-e_k
&=(q/p)^k(e_1-e_0)-\sum_{i=0}^{k-1}(q^i/p^{i+1})
\\&=(q/p)^k(-1)-\frac{1-(q/p)^k}{p-q}
\\e_{k+1}-e_k
&=(q/p)^k\frac{2q}{p-q}-\frac1{p-q}
\tag{*}
\end{align}
Now, take equation $(*)$ and sum both sides from $k=1$ to $n-1$. The left hand telescopes to $e_n-e_1=-e_1$, and the right hand side can be simplified. This lets you solve for $e_1$. You can then sum $(*)$ from $k=1$ to $m-1$ to get a formula for $e_m$, for all $m$. The result is
$$
-e_1=\frac{2q}{p-q}\cdot\frac{(q/p)^n-q/p}{q/p-1}-\frac{n-1}{p-q}
$$
$$
e_1=\frac{n-1}{p-q}+2\cdot \frac{(q/p)^{n+1}-(q/p)^2}{(q/p-1)^2}
$$
$$
\bbox[5px, #ddddef, border: solid black 2px]
{e_m=\frac{n-m}{p-q}+2\cdot \frac{(q/p)^{n+1}-(q/p)^{m+1}}{(q/p-1)^2}}
$$
This is only valid for $m\ge 1$, but $e_0$ is simply $1+e_1$.
If $z_k$ is the expected number of returns to zero starting from $k$, then you instead have
\begin{align}
z_{k}&=pz_{k+1}+qz_{k-1},\qquad k=1,2,\dots,n-1\\
z_n&=0,\\
z_0&=1+z_1.
\end{align}
We are counting the number of times you move from $0$ to $1$, which is the same as the number of visits to zero. This is even easier to solve. You instead have
$$
z_{k+1}-z_k=(q/p)^k(z_1-z_0)=(q/p)^k(-1)\tag{**}
$$
Therefore, using a telescopic sum with $(**)$,
$$
-z_1=-\sum_{k=1}^{n-1}(q/p)^k\implies z_1=\frac{(q/p)^n-q/p}{q/p-1}
$$
$$
z_m-z_1=-\sum_{k=1}^{m-1}(q/p)^k\implies \bbox[5px, #ddddef, border: solid black 2px]
{z_m=\frac{(q/p)^n-(q/p)^m}{q/p-1}}
$$
Again, this assumes $m\ge 0$.
Let $B_{n,m}$ be the probability that starting with $\$m$, you hit $\$0$ before you hit $\$n$. This is the classical gambler's ruin problem, whose solution is well known to be
$$
B_{n,m} = \frac{(q/p)^n-(q/p)^m}{(q/p)^n-1}
$$
Letting $N$ be the number of times you reach zero before reaching $n$, then
$$
\bbox[5px, #ddddef, border: solid black 2px]
{
P(N=k)=
\begin{cases}
B_{n,m}\cdot B_{n,1}^{k-1}\cdot (1-B_{n,1}) & k>0 \\
1-B_{n,m} & k = 0
\end{cases}
}
$$
Best Answer
Say you have $k$ dollars and will stop if you reach either $0$ or $n$. Then the probability of winning (i.e. reaching $n$) satisfies the recurrence
$$ x_k=\frac23x_{k+1}+\frac13x_{k-1}\;, $$
or
$$2x_{k+1}-3x_k+x_{k-1}=0\;.$$
The ansatz $x_k=\lambda^k$ yields the characteristic equation $2\lambda^2-3\lambda+1=0$ with solutions $\lambda=1$ and $\lambda=\frac12$. Thus the winning probability has the form $x_k=c_1+c_22^{-k}$. Substituting $x_0=0$ and $x_n=1$ yields $c_1+c_2=0$ and $c_1+c_22^{-n}=1$ and thus $c_1=-c_2=1/(1-2^{-n})$ and
$$ x_k=\frac{1-2^{-k}}{1-2^{-n}}\;. $$
You want $x_{n-2}\ge0.99$ and thus
$$ \frac{1-2^{-(n-2)}}{1-2^{-n}}\ge0.99\;, $$
or $(1-0.99)\ge(4-0.99)2^{-n}$ and thus $n\gt8.23$. With $n=9$, the initial fortune must be $9-2=7$.