Let $w^*$ be your target wealth and $w_0$ be your initial amount. One very effective strategy one could apply is the following,
Day 1: Bet $w^* - w_0$; if the bet resolves in your favour then you have reached your target wealth and so stop; Else
Day 2: Bet $2(w^* -w_0)$; if the bet resolves in your favour then you have reached your target wealth and so stop; Else
Day 3: Bet $4(w^* -w_0)$; if the bet resolves in your favour then you have reached your target wealth and so stop; Else
...
Day N: Bet $2^{N-1}(w^* -w_0)$ if the bet resolves in your favour then you have reached your target wealth and so stop; Else you have insufficient funds to reach your target wealth; i.e. $2w(t) < w^*$ :(
The number of bets you can place is then $N+1$ where $N$ is the largest integer such that,
$$ 2 \Big ( w_0 - (w^* - w_0) \sum_{k=0}^N 2^k \Big ) \geq w^*$$
That is,
The probability of the strategy being successful is then the complement of the strategy failing in each trial,
$$ 1 - (1-p)^{N+1} $$
For example, if probability of success is $p=0.6$, initial amount is $w(0)=w_0 = 100$, and target wealth is $w^* = 105$ then you can place $4$ bets each with the possibility of achieving the target wealth. The probability of success is the complement of the probability of failure which is, $(1-0.6)^4 = 0.0256$ and so probability of reaching your target wealth is $1 - 0.0256 = 0.9744 $ which is pretty good. You can visualize this with a tree diagram and it helps to explain the reasoning.
All in all, I am not sure if this is optimal but it seems very effective.
I realized also the policy, $f = f(w)$ can be expressed as,
$$ w(t+1) = w(t) + \max\{0,w^* - w(t)\}\mathcal{X}_{t+1}$$
for $t \leq T$ with $T$ chosen such that it is the largest integer for which $2w(T-1) \geq w^*$ in all cases, in particular where you lose in every bet. $\mathcal{X}_{t+1}$ is a random variable which takes the values $1$ and $-1$ with appropriate probabilities.