Tag - dynamic programming in java