Common dynamic programming problems and junit tests