dynamic programming example

find the maximum net profit