DP solution for calculating longest non descreasing sequence.