Probability question: Optimal strategy of playing You are stuck in a casino where the only game you can play is to bet any positive integral amount $X$ of dollars (no more than what you currently have, so you are stuck if you have zero dollars) on an unfair coin where you win X dollars with a fixed probability $p$ and lose $X$ dollars with probability $1-p$, and $p < ½$. You can bet a different amount each time you play the game.
You have $200$ dollars and need $500$ dollars to leave. You want to maximize the probability of being able to leave. How do you optimally play this game and why?

I have zero ideas how to solve this problem. Any insights/hints will also be greatly appreciated.
[Problem adapted from a selection test which is over.]
 A: Here is how I would approach the question, though I cannot guarantee that this is the best strategy.
Note that to win \$500 you need to win at least twice.  As @jvdhooft mentioned in the comments, you want to minimize the number of wins you are aiming for because $p^n \rightarrow 0$ as $n \rightarrow \infty$.
There are 3 "extreme" cases in which you only need to win twice to get \$500. I will denote these strategies by the first bet being \$50, \$75, or \$200.  I mention \$75 because this allows you to lose your first bet, but still win twice for \$500. 
Based on this tree, you can see that for all 3 methods, the probability of hitting \$500 is $p^2 + p^2(1-p) + r$ where $r$ is a small remainder function.
To see which of the 3 options is the best, take the expected value of each:
$$E_{50} = 500p^2 + 500p^2(1-p) + \mathbf{50(1-p)^2}$$
$$E_{75} = 500p^2 + 500p^2(1-p) + \mathbf{25p(1-p)}$$
$$E_{200} = 500p^2 + 500p^2(1-p) + \mathbf{100p(1-p)^2}$$
Since the first half of the equations are equal, we only need to compare the remaining bolded equations to compare which is greatest.
By punching the equations into wolframalpha, we see that: 


*

*$50(1-p)^2$ is greater than $25p(1-p)$ while $p<2/3$

*$50(1-p)^2$ is greater than $100p(1-p)^2$ while $p<1/2$


Therefore, I believe that the best strategy is the "bet 50" strategy, defined by this tree.
