adding max segmentation dp algo