quick example of how to use a histomorphism to solve a dynamic programming problem