RT:

代码如下:

 1 int lisq(int * a,int N)
 2 { int e1=a[0],e2=a[0];
 3   int L1=1,L2=1;
 4   int i;
 5  
 6   for(i=1;i<N;i++)
 7    {
 8         if(a[i]>e1)
 9           {
10             e1=a[i];
11             L1++;
12           }
13  
14        if(a[i]>e2)
15          {
16             e2=a[i];
17             L2++;
18          }
19        else
20         {
21           e2=a[i];
22            L2=1;
23        }
24  
25       if(e1==e2)
26          L1=L1>L2?L1:L2;
27  }
28  
29    return L1;

时间复杂度为O(N)