Optimal Betting Strategy question I am preparing for an exam in probability theory and I bumped against a question I can't solve.
Given are an integer starting capital $k$, an end goal capital $m$ and a period of $n$ days. Each day I can bet some integer amount $X$ of my choosing $(X \leq k)$ on an unfair coin landing on heads. The probability the coin lands on heads is different each day, with $p_i$ denoting the probability of it landing on heads on day $i$ with $i \in (1,...,n)$. If the bet is successful, I increase my capital by $X$, if not I lose $X$ amount. (All probabilities $p_1, p_2,..., p_n$ are known before the betting process starts).
The question is: With an optimal betting strategy, what is the probability of achieving capital at least equal to $m$ after $n$ days?
An example input: $n = 5, k = 2, m = 20, p_1 = 0.3, p_2 = 0.5, p_3 = 0.2, p_4 = 0.7, p_5 = 1.0$
Though not from a homework, if this question falls under the category of questions one should solve by themselves or look for help from a tutor or elsewhere, please tell me, I will take it down. Any advice as to how to approach the problem would be awesome though.

It seems to me that this question is much easier than people are making it out to be, although I might be wrong here.
First: The optimal strategy will at each betting day be the one that increases the expected gains the most. Therefore you should bet all your capital if $p>0.5$, since the expected return is the largest.
Second: The probability of having capital after n days with the optimal strategy is equal to the product of the probabilities of the days you bet, so hence:
$$P(\text{"Return larger than m"}) = \begin{cases}\prod_{bet\in bets}p_{bet}&2^{|bets|}k>m\\0&\text{else}\end{cases}$$
For your example $n=5,k=2,m=20,p_1=0.3,p_2=0.5,p_3=0.2,p_4=0.7,p_5=1.0$, we have that the probability of having capital left is: $p_4p_5=0.7$, but since $m=20$ the probability that we end up with a return greater or equal to this value is 0.
I think most other people here have attempted to solve the much harder problem of optimizing the probability of having the return be greater or equal to m, but from what I understand that is not the actual assignment, so the solution I presented here should be correct.
Also, this problem reminds me a lot of the St. Petersburg paradox, which I quite like.
