Dynamic programming on Longest Increasing Substring