Some solutions for problems involving dynamic programming