Let $p$ be the probability that the coin comes up heads. Suppose that you’ve tossed a head $n$ times. If you play one more time, your expected payoff is $100(n+1)p$; if this is less than the $100n$ that you’ve won so far, you shouldn’t play again. The inequality $100(n+1)p<100n$ boils down to $n(1-p)>p$, or $n>\frac{p}{1-p}$; if $n=\frac{p}{1-p}$, your expected payoff is equal to your current winnings. Thus, if $n\ge\left\lfloor\frac{p}{1-p}\right\rfloor+1$, you should not play again. If $n=\frac{p}{1-p}$, you can play again or not. And if $n<\frac{p}{1-p}$, you should play again. We can get a slightly nicer expression for the cutoff: you should stop when $n$ reaches
$$\left\lfloor\frac{p}{1-p}\right\rfloor+1=\left\lfloor\frac1{1-p}-1\right\rfloor+1=\left\lfloor\frac1{1-p}\right\rfloor\;.$$
For a fair coin, with $p=\frac12$, this says that if $n>1$, you shouldn’t play again: if you toss heads once, you can go ahead and try again or not, as you please, but if you toss heads twice, you should quit. If $p=4/5$, the cutoff is $n>4$: if you’ve managed to toss four heads in a row, you can try again or not, but if you’ve managed five, quit.
To see how this relates to Sam’s calculus-based answer, start with the Maclaurin series for $\ln(1-x)$:
$$\ln p=-\sum_{n\ge 1}\frac{(1-p)^n}n\;,$$
so
$$\frac1{-\ln p}=\frac1{\sum_{n\ge 1}\frac{(1-p)^n}n}=\frac1{1-p}\cdot\frac1{1+\frac12(1-p)+\frac13(1-p)^2+\ldots}\;.$$
Clearly $1<1+\frac12(1-p)+\frac13(1-p)^2+\ldots<\sum_{k\ge 0}(1-p)^k=\frac1p$, so
$$\frac{p}{1-p}<\frac1{-\ln p}<\frac1{1-p}=\frac{p}{1-p}+1\;.$$
On the last toss, you want to maximize
$$
\frac12\left(\log(x+2S)+\log(x-S)\right)\;,
$$
where $x$ is your balance before the last toss. Differentiating with respect to $S$, setting to zero and solving for $S$ yields $S=x/4$. The expected value for this optimal bet is
$$
\frac12\left(\log(x+x/2)+\log(x-x/4)\right)=\log x+\log3-\frac32\log 2\approx\log x+0.06\;.
$$
Thus the expected value is simply the value $\log x$ you had before plus about $0.06$. It follows that on the previous toss you should also maximize the expected value of the logarithm of the balance, and likewise for all previous tosses, so on each toss you should bet one quarter of your current balance, and the expected value after $100$ tosses is
$$\log100+100\left(\log3-\frac32\log 2\right)\approx10.49\;.$$
(To compare with Ross' answer: I'm using natural logarithms whereas he uses decimal logarithms.)
Best Answer
I haven't been able to find a formula for this. As I said in a comment, it's not hard to show the the expected number of tosses is $k^2$, but that doesn't tell us the probability, of course. (If the current score is $s$, the expected number number of tosses to reach $\pm k$ is $k^2-s^2$.)
I computed the probabilities for $5\leq k\leq 30$. here they are:
and here's a graph: I did this by declaring that the game ends in a tie if there is no winner after $100$ tosses. Then we have a Markov chain with $3$ absorbing states, and I calculated the probability of absorption in the "tie" state.
I was surprised that with $k=20$, the probability of a tie was only $90.6\%$, since the expected number of tosses until some is ahead by $20$ is $400$. However, I simulated $100,000$ trials, and there were $90,806$ ties.
Now that I think of it, my first reaction to the question was, "Well, if I knew $k$, I just do a simulation." Perhaps that was the answer the interviewer was looking for.
I thought about computing first passage times, as I mentioned in a comment, but I thought I'd end up writing a script to calculate them anyway. The way I did it, making a state consist of the score and the number of tosses was overkill, especially since I included lots of unreachable states, but it was easy to program, and fast enough in execution.
ADDENDUM
To calculate the expected number of tosses, let $E(n)$ be the expected number of tosses to reach $\pm k$ if the current score is $n$. We know $E(k)=E(-k)=0$ and we want to compute $E(0)$. We have the recurrence $$E(n)= 1+\frac12E(n-1)+\frac12E(n+1),\ -k<n<k$$
Standard techniques give the solution $$E(n)=k^2-n^2$$ so $E(0)=k^2$.