Implementation of Dynamic Programing Problem in TopCoder Tutorial: DP problems which have an additional condition.