Solution (source code)

= Solution

Put $q=1-p$ and $\xi_i=Y_i-Y_{i-1}$. The <Markov property> and the state-independent transition probabilities show that, conditional on the whole previous history, $\xi_i$ is $+1$ with <probability> $p$ and $-1$ with <probability> $q$. Multiplying these conditional probabilities for any finite step sequence proves that the $\xi_i$ are <independent and identically distributed random variables>, with
$$
\mathbb E\xi_i=p-q=2p-1>0.
$$
Because $Y_n=k+\sum_{i=1}^n\xi_i$, the <strong law of large numbers> gives
$$
\boxed{\frac{Y_n}{n}=\frac kn+\frac1n\sum_{i=1}^n\xi_i
\xrightarrow{\mathrm{a.s.}}\mu=2p-1.}
$$
In particular, $Y_n\to+\infty$ <almost surely>. This stronger pathwise consequence will determine both eventual crossings and the asymptotic <first-passage times>.