Thursday, October 20, 2011

Find the longest non decreasing subsequence

Solution: s_i = max ( max (s_j + 1), 1) for j < i and A[j] <  A[i]. So take an already available longest non decreasing subsequence and if you find a subsequent A[i] > A[j] then sum 1. Remember that the minimum is 1

No comments:

Post a Comment