-
int MaxDesc(int param[], int length)
-
{
-
if(param==NULL||length<1)
-
{
-
return -1;
-
}
-
if(length==1)
-
{
-
return 1;
-
}
-
int pre=-1;
-
int cur=-1;
-
int maxCount=0;
-
int curCount=0;
-
pre=0;
-
cur=1;
-
while(cur<length)
-
{
-
if(param[pre]>param[cur])
-
{
-
++curCount;
-
pre++;
-
cur++;
-
}
-
else
-
{
-
if(curCount>maxCount)
-
{
-
maxCount=curCount;
-
}
-
curCount=0;
-
pre=cur;
-
cur++;
-
}
-
}
-
if(curCount>maxCount)
-
{
-
maxCount=curCount;
-
}
-
return maxCount+1;
-
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29012686/viewspace-1162079/
,如需转载,请注明出处,否则将追究法律责任。