review dynamic program problem best time to sell stock