Reaching a level before another for a random walk
Hint: Since $(S_n)_{n \in \mathbb N}$ is a martingale, you can use the fact that $$\begin{align*}E[S_T]&=aP(S_T=a)+bP(S_T=b)=\\&=aP(S_T=a)+b(1-P(S_T=a))=(a-b)(P(S_T=a))+b=\\&=(a-b)P(T_a<T_b)+b\end{align*}$$ (where $S_T=\inf\{n|S_n \in \{a,b\}\}$) and the optional stopping theorem, i.e. that $$E[S_T]=E[S_0]=0$$ to deduce that $$P(S_T=a)=P(T_a<T_b)=\frac{-b}{a-b}$$