找出一个数组中最长递增序列的长度
#include <iostream>
using namespace std;
int main()
{
int a[7] = {9,2,3,4,5,1,3};
sort(a,a+7);
int length = 7;
int count[7] = {0};
for(int i = 0;i < length; i++ ){
int res = 0;
for (int j = i;j < length; j++){
if(a[j]<a[j+1]){
res++;
continue;
}else{
res++;
count[i] = res;
break;
}
}
}
int max = -1;
for(int i = 0;i<length;i++){
if(count[i]>max)
max = count[i];
}
cout << max;
return 0;
}