I solve the Gambler's Problem using Value Iteration from the book Reinforcement Learning (2nd Edition) by Richard S. Sutton and Andre G. Barto
Problem: A gambler has the opportunity to make bets on the outcomes of a sequence of coin flips. If the coin comes up heads, he wins as many dollars as he has staked on that flip; if it is tails, he loses his stake. The game ends when the gambler wins by reaching his goal of $100, or loses by running out of money. On each flip, the gambler must decide what portion of his capital to stake, in integer numbers of dollars.