最长递增子序列(longest increasing subsequence)
问题
给定一个长度为N的数组,找出一个最长的单调自增子序列(不一定连续,但是顺序不能乱)。例如:给定一个长度为6的数组A{5, 6, 7, 1, 2, 8},则其最长的单调递增子序列为{5,6,7,8},长度为4.
int LIS(int nums[], int n, int result[]){//暴力法,时间O(n^2)
int* lis = new int[n];
int*
原创
2015-10-20 16:16:30 ·
339 阅读 ·
0 评论