最长递增子序列(Longest increasing subsequences)
问题描述:
the input is a sequence of numbers a1, a2, ……, an. A subsequence is any subset of these numbers taken in order, of the form ai1, ai2, ……, aik where 1 <= i1 <= i2 <= … ik <= n, and an increasing subsequence is one in which the numbers are getting strictly larger.(标蓝的数字均为下标)
The task is to find the increasing subsequence of greatest length. For instance, the longest increasing subsequence of 5, 2, 8, 6, 3, 6, 9, 7 is 2, 3, 6, 9.
❗算法思想❗:
定义 lis[i] 为截至到第 i 个数字为止,最长递增子序列的长度,path[i] 为截至到第 i 个数字为止,最长递增