题目描述:The longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order. For example, length of LIS for { 10, 22, 9, 33, 21, 50, 41, 60, 80 } is 6 and LIS is {10, 22, 33, 50, 60, 80}.
题目大致意思是,在数组中找出最长的递增子序列,并返回其长度。
解法一:
L[i]代表以A[i]结尾时的LIS,那么L[i]可以用以下公式表示,
L[i] = {1 + max(L[j]) },其中j<i&&A[j]<A[i].